1
- # Build matrix
1
+ # Setup matrix
2
2
3
3
GitHub action to create reusable dynamic job matrices for your workflows.
4
4
@@ -10,29 +10,29 @@ The main goal of this action is to be as much compatible with built-in
10
10
as possible and thus allow you a smooth transition in your workflow.
11
11
12
12
All given examples can be found as GitHub workflows in
13
- [ this repository] ( https://github.com/druzsan/test-build -matrix ) .
13
+ [ this repository] ( https://github.com/druzsan/test-setup -matrix ) .
14
14
15
15
## Basic usage
16
16
17
17
``` yaml
18
18
jobs :
19
- # Build matrix
20
- build -matrix :
19
+ # Setup matrix
20
+ setup -matrix :
21
21
runs-on : ubuntu-latest
22
22
outputs :
23
- matrix : ${{ steps.build .outputs.matrix }}
23
+ matrix : ${{ steps.setup-matrix .outputs.matrix }}
24
24
steps :
25
- - id : build
26
- uses : druzsan/build -matrix@v1
25
+ - id : setup-matrix
26
+ uses : druzsan/setup -matrix@v1
27
27
with :
28
28
matrix : |
29
29
os: ubuntu-latest windows-latest macos-latest,
30
30
python-version: 3.8 3.9 3.10
31
31
# Setup python and print version
32
32
setup-python :
33
- needs : build -matrix
33
+ needs : setup -matrix
34
34
strategy :
35
- matrix : ${{ fromJson(needs.build -matrix.outputs.matrix) }}
35
+ matrix : ${{ fromJson(needs.setup -matrix.outputs.matrix) }}
36
36
runs-on : ${{ matrix.os }}
37
37
steps :
38
38
- uses : actions/setup-python@v4
@@ -138,7 +138,7 @@ install python dependencies, check code quality and run unit tests.
138
138
139
139
` ` ` yaml
140
140
jobs:
141
- # No matrix build
141
+ # No matrix setup
142
142
# Setup python environment and cache installed packages
143
143
setup-python:
144
144
strategy:
@@ -193,23 +193,23 @@ jobs:
193
193
194
194
` ` ` yaml
195
195
jobs:
196
- # Build matrix
197
- build -matrix:
196
+ # Setup matrix
197
+ setup -matrix:
198
198
runs-on: ubuntu-latest
199
199
outputs:
200
- matrix: ${{ steps.build .outputs.matrix }}
200
+ matrix: ${{ steps.setup-matrix .outputs.matrix }}
201
201
steps:
202
- - id: build
203
- uses: druzsan/build -matrix@v1
202
+ - id: setup-matrix
203
+ uses: druzsan/setup -matrix@v1
204
204
with:
205
205
matrix: |
206
206
os: ubuntu-latest windows-latest macos-latest,
207
207
python-version: 3.8 3.9 3.10
208
208
# Setup python environment and cache installed packages
209
209
setup-python:
210
- needs: build -matrix
210
+ needs: setup -matrix
211
211
strategy:
212
- matrix: ${{ fromJson(needs.build -matrix.outputs.matrix) }}
212
+ matrix: ${{ fromJson(needs.setup -matrix.outputs.matrix) }}
213
213
runs-on: ${{ matrix.os }}
214
214
steps:
215
215
- uses: actions/checkout@v3
@@ -220,9 +220,9 @@ jobs:
220
220
- run: python -m pip install -r requirements.txt
221
221
# Check code quality
222
222
check-code:
223
- needs: [build -matrix, setup-python]
223
+ needs: [setup -matrix, setup-python]
224
224
strategy:
225
- matrix: ${{ fromJson(needs.build -matrix.outputs.matrix) }}
225
+ matrix: ${{ fromJson(needs.setup -matrix.outputs.matrix) }}
226
226
runs-on: ${{ matrix.os }}
227
227
steps:
228
228
- uses: actions/checkout@v3
@@ -236,9 +236,9 @@ jobs:
236
236
- run: pylint src
237
237
# Test code
238
238
unit-test:
239
- needs: [build -matrix, setup-python]
239
+ needs: [setup -matrix, setup-python]
240
240
strategy:
241
- matrix: ${{ fromJson(needs.build -matrix.outputs.matrix) }}
241
+ matrix: ${{ fromJson(needs.setup -matrix.outputs.matrix) }}
242
242
runs-on: ${{ matrix.os }}
243
243
steps:
244
244
- uses: actions/checkout@v3
@@ -250,7 +250,7 @@ jobs:
250
250
- run: python -m pytest
251
251
` ` `
252
252
253
- # ## Build dynamic matrix
253
+ # ## Setup dynamic matrix
254
254
255
255
Sometimes you need to run a job on different sets of configurations, depending
256
256
on branch, triggering event etc.
@@ -260,7 +260,7 @@ on branch, triggering event etc.
260
260
261
261
` ` ` yaml
262
262
jobs:
263
- # No matrix build
263
+ # No matrix setup
264
264
# Test code on a dev branch
265
265
unit-test-dev:
266
266
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
@@ -313,18 +313,18 @@ jobs:
313
313
314
314
` ` ` yaml
315
315
jobs:
316
- # Build matrix
317
- build -matrix:
316
+ # Setup matrix
317
+ setup -matrix:
318
318
runs-on: ubuntu-latest
319
319
steps:
320
320
- if: startsWith(github.ref, 'refs/tags/v')
321
- uses: druzsan/build -matrix@v1
321
+ uses: druzsan/setup -matrix@v1
322
322
with:
323
323
matrix: |
324
324
os: ubuntu-latest windows-latest macos-latest,
325
325
python-version: 3.8 3.9 3.10
326
326
- if: github.ref == 'refs/heads/main'
327
- uses: druzsan/build -matrix@v1
327
+ uses: druzsan/setup -matrix@v1
328
328
with:
329
329
matrix: |
330
330
os: ubuntu-latest,
@@ -333,7 +333,7 @@ jobs:
333
333
os: windows-latest python-version: 3.8,
334
334
os: macos-latest python-version: 3.8
335
335
- if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
336
- uses: druzsan/build -matrix@v1
336
+ uses: druzsan/setup -matrix@v1
337
337
with:
338
338
matrix: |
339
339
os: ubuntu-latest,
@@ -345,9 +345,9 @@ jobs:
345
345
matrix: ${{ steps.set-matrix.outputs.matrix }}
346
346
# Test code
347
347
unit-test:
348
- needs: build -matrix
348
+ needs: setup -matrix
349
349
strategy:
350
- matrix: ${{ fromJson(needs.build -matrix.outputs.matrix) }}
350
+ matrix: ${{ fromJson(needs.setup -matrix.outputs.matrix) }}
351
351
runs-on: ${{ matrix.os }}
352
352
steps:
353
353
- uses: actions/checkout@v3
0 commit comments