Skip to content

Commit 2c4c8ad

Browse files
committed
Refactor check workflow
- use matrix to test multiple scenarios - get rid of perl tests: to make this action as primary source of perl versions in github workflow ecosystem so it should not use something that uses this action to produce its artifacts
1 parent a49f5a8 commit 2c4c8ad

File tree

1 file changed

+53
-95
lines changed

1 file changed

+53
-95
lines changed

.github/workflows/check.yml

Lines changed: 53 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,108 +3,66 @@ name: "Check Workflow"
33
on: [push, pull_request]
44

55
jobs:
6-
7-
since-v520:
6+
test-action:
87
runs-on: ubuntu-latest
9-
name: 'since v5.20'
10-
outputs:
11-
perl-versions: ${{ steps.action.outputs.perl-versions }}
12-
steps:
13-
- uses: actions/checkout@v4
14-
- name: "uses perl-versions"
15-
id: action
16-
uses: ./
17-
with:
18-
since-perl: v5.20
8+
strategy:
9+
matrix:
10+
include:
11+
- job-id: since-v520
12+
name: "Since v5.20"
13+
since-perl: "v5.20"
14+
expected: '["5.20","5.22","5.24","5.26","5.28","5.30","5.32","5.34","5.36","5.38","5.40","5.42"]'
1915

20-
since-520:
21-
runs-on: ubuntu-latest
22-
name: 'since 5.20'
23-
outputs:
24-
perl-versions: ${{ steps.action.outputs.perl-versions }}
25-
steps:
26-
- uses: actions/checkout@v4
27-
- name: "uses perl-versions"
28-
id: action
29-
uses: ./
30-
with:
31-
since-perl: "5.20"
16+
- job-id: since-520
17+
name: "Since 5.20"
18+
since-perl: "5.20"
19+
expected: '["5.20","5.22","5.24","5.26","5.28","5.30","5.32","5.34","5.36","5.38","5.40","5.42"]'
3220

33-
since-536-with-devel:
34-
runs-on: ubuntu-latest
35-
name: 'since 5.36 with devel'
36-
outputs:
37-
perl-versions: ${{ steps.action.outputs.perl-versions }}
38-
steps:
39-
- uses: actions/checkout@v4
40-
- name: "uses perl-versions"
41-
id: action
42-
uses: ./
43-
with:
44-
since-perl: 5.36
45-
with-devel: true
21+
- job-id: since-536-with-devel
22+
name: "Since 5.36 with devel"
23+
since-perl: "5.36"
24+
with-devel: "true"
25+
expected: '["5.36","5.38","5.40","5.42","devel"]'
4626

47-
since-524-to-532:
48-
runs-on: ubuntu-latest
49-
name: 'since 5.24 to 5.32'
50-
outputs:
51-
perl-versions: ${{ steps.action.outputs.perl-versions }}
52-
steps:
53-
- uses: actions/checkout@v4
54-
- name: "uses perl-versions"
55-
id: action
56-
uses: ./
57-
with:
58-
since-perl: "5.24"
59-
to-perl: "5.32"
27+
- job-id: since-524-to-532
28+
name: "Since 5.24 until 5.32"
29+
since-perl: "5.24"
30+
until-perl: "5.32"
31+
expected: '["5.24","5.26","5.28","5.30","5.32"]'
6032

61-
test-matrix:
62-
runs-on: ubuntu-latest
63-
needs:
64-
- since-536-with-devel
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
perl-versions: ${{ fromJson (needs.since-536-with-devel.outputs.perl-versions) }}
69-
steps:
70-
- run: echo "Hello"
33+
- job-id: with-devel-and-until
34+
name: "With devel and until-perl"
35+
since-perl: "5.36"
36+
until-perl: "5.40"
37+
with-devel: "true"
38+
expected: '["5.36","5.38","5.40","devel"]'
7139

72-
perl-tester:
73-
runs-on: ubuntu-latest
74-
needs:
75-
- since-536-with-devel
76-
name: "Perl ${{ matrix.perl-version }}"
77-
strategy:
78-
fail-fast: false
79-
matrix:
80-
perl-version: ${{ fromJson (needs.since-536-with-devel.outputs.perl-versions) }}
81-
container:
82-
image: perldocker/perl-tester:${{ matrix.perl-version }}
83-
steps:
84-
- uses: actions/checkout@v4
85-
- run: perl -V
40+
- job-id: single-version
41+
name: "Single version"
42+
since-perl: "5.32"
43+
until-perl: "5.32"
44+
expected: '["5.32"]'
8645

87-
check:
88-
needs:
89-
- since-v520
90-
- since-520
91-
- since-536-with-devel
92-
- since-524-to-532
93-
runs-on: ubuntu-latest
94-
steps:
46+
- job-id: oldest-supported
47+
name: "Oldest supported version is 5.8"
48+
since-perl: "5.6"
49+
until-perl: "5.14"
50+
expected: '["5.8","5.10","5.12","5.14"]'
9551

96-
- name: "Testing since-v520"
97-
run: |
98-
[[ '${{ needs.since-v520.outputs.perl-versions }}' == '["5.20","5.22","5.24","5.26","5.28","5.30","5.32","5.34","5.36","5.38","5.40","5.42"]' ]] && echo "ok"
99-
100-
- name: "Testing since-520"
101-
run: |
102-
[[ '${{ needs.since-520.outputs.perl-versions }}' == '["5.20","5.22","5.24","5.26","5.28","5.30","5.32","5.34","5.36","5.38","5.40","5.42"]' ]] && echo "ok"
52+
steps:
53+
- uses: actions/checkout@v4
10354

104-
- name: "Testing since-536-with-devel"
105-
run: |
106-
[[ '${{ needs.since-536-with-devel.outputs.perl-versions }}' == '["5.36","5.38","5.40","5.42","devel"]' ]] && echo "ok"
55+
- name: "Call action - ${{ matrix.name }}"
56+
id: call-action
57+
uses: ./
58+
with:
59+
since-perl: ${{ matrix.since-perl }}
60+
until-perl: ${{ matrix.until-perl || null }}
61+
with-devel: ${{ matrix.with-devel || null }}
10762

108-
- name: "Testing since-524-to-532"
109-
run: |
110-
[[ '${{ needs.since-524-to-532.outputs.perl-versions }}' == '["5.24","5.26","5.28","5.30","5.32"]' ]] && echo "ok"
63+
- name: Validate output - ${{ matrix.name }}
64+
uses: prompt/actions-assert@v4
65+
with:
66+
assertion: npm://@assertions/is-equal:v1
67+
actual: ${{ steps.call-action.outputs.perl-versions }}
68+
expected: ${{ matrix.expected }}

0 commit comments

Comments
 (0)