Skip to content

Commit

Permalink
Update basic usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Feb 8, 2024
1 parent 46e3cfe commit c6984f5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-builtin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: '2.1. 🔍 CI (built-in matrix)'
name: '🔍 CI (built-in matrix)'

on: push

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: '2.2. 🔍 CI'
name: '🔍 CI'

on: push

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: '1. ⏱️ Basic usage'
name: '⏱️ Quickstart'

on:
push:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:

# This is action integration test and quickstart example at the same time.

jobs:
# Setup matrix
setup-matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-builtin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: '3.1. 🧪 Test (built-in matrix)'
name: '🧪 Test (built-in matrix)'

on: push

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: '3.2. 🧪 Test'
name: '🧪 Test'

on: push
on:
push:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:

# This is action code test, action integration test and advanced usage example
# at the same time.
Expand Down
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Setup matrix
# ✉️ Setup matrix

GitHub action to create reusable dynamic job matrices for your workflows.

Expand All @@ -12,7 +12,7 @@ as possible and thus allow you a smooth transition in your workflow.
All given examples can be found as GitHub workflows in
[this repository](https://github.com/druzsan/test-setup-matrix).

## Basic usage
## Quickstart

```yaml
jobs:
Expand All @@ -23,22 +23,29 @@ jobs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
steps:
- id: setup-matrix
uses: druzsan/setup-matrix@v1
uses: druzsan/setup-matrix@v2
with:
matrix: |
os: ubuntu-latest windows-latest macos-latest,
python-version: 3.8 3.9 3.10
fruit: [apple, pear]
animal: [quick red fox, lazy dog]
include:
- color: green
- color: pink
animal: quick red fox
- color: brown
animal: cat
exclude:
- fruit: apple
animal: lazy dog
# Setup python and print version
setup-python:
echo:
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python-version }}'
- run: python --version
- run: |
echo "fruit: ${{ matrix.fruit }}, animal: ${{ matrix.fruit }}, color: ${{ matrix.color }}"
```
For more examples, see [advanced usage](#advanced-usage)
Expand All @@ -58,10 +65,13 @@ recommended to use (any) YAML multiline strings to unclutter your inputs, e.g.:
```yaml
with:
matrix: |
node-version: 12 14 16
include: |
node-version: 16
npm: 6
os: [ubuntu-latest]
python-version: [3.8, 3.10, 3.12]
include:
- os: windows-latest
python-version: 3.8
- os: macos-latest
python-version: 3.8
```
All words themselves must not contain any whitespaces, colons and commas. All
Expand Down

0 comments on commit c6984f5

Please sign in to comment.