69 lines (65 loc) · 2 KB
/
manual-matrix-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Manual Matrix Test
on:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
changed-files:
name: Get changes
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix-raw-format: ${{ steps.set-matrix-json-raw-format.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed for tj-actions/changed-files
- name: Get changed files
id: changed-files
uses: ./
with:
json: true
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
- id: set-matrix
run: echo "matrix={\"container\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
- name: Get changed files json raw format
id: changed-files-json-raw-format
uses: ./
with:
json: true
json_raw_format: true
- name: List all changed files json raw format
run: echo '${{ steps.changed-files-json-raw-format.outputs.all_changed_files }}'
- id: set-matrix-json-raw-format
run: echo "matrix={\"container\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
matrix-job:
name: Run Matrix Job
runs-on: ubuntu-latest
needs: [changed-files]
strategy:
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
max-parallel: 4
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test
run: |
echo ${{ matrix.container }}
matrix-job-json-raw-format:
name: Run Matrix Job json raw format
runs-on: ubuntu-latest
needs: [changed-files]
strategy:
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix-raw-format) }}
max-parallel: 4
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test
run: |
echo ${{ matrix.container }}