Skip to content

Commit 8405686

Browse files
authored
Merge pull request #13 from happy-barney/hpb/until-perl
Rename `to-perl` to `until-perl`
2 parents edf86e4 + 889bfdd commit 8405686

File tree

5 files changed

+81
-104
lines changed

5 files changed

+81
-104
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 }}

.github/workflows/perl-versions.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
type: string
99
required: true
1010
default: "5.10"
11+
until-perl:
12+
description: "List all Perl versions up to this (including this). Example: 5.30"
13+
type: string
14+
required: false
15+
with-devel:
16+
description: "Whether to include also 'devel' Perl"
17+
type: boolean
18+
required: false
19+
default: false
1120
outputs:
1221
perl-versions:
1322
value: ${{ jobs.perl-versions.outputs.perl-versions }}
@@ -24,4 +33,6 @@ jobs:
2433
uses: perl-actions/perl-versions@main
2534
with:
2635
since-perl: ${{ inputs.since-perl }}
36+
until-perl: ${{ inputs.until-perl || null }}
37+
with-devel: ${{ inputs.with-devel || null }}
2738

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
description: "List all Perl versions since this (including this). Example: 5.10"
66
type: string
77
required: true
8-
to-perl:
8+
until-perl:
99
description: "List all Perl versions up to this (including this). Example: 5.30"
1010
type: string
1111
required: false

dist/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30265,10 +30265,14 @@ let available = [
3026530265
"devel",
3026630266
];
3026730267

30268+
function parse_input_version (input_name) {
30269+
// semver.coerce() returns null for both empty string and null inputs
30270+
return semver.coerce (core.getInput (input_name));
30271+
}
30272+
3026830273
try {
30269-
const since_perl = semver.coerce(core.getInput('since-perl'));
30270-
const to_perl_input = core.getInput('to-perl');
30271-
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
30274+
const since_perl = parse_input_version ('since-perl');
30275+
const until_perl = parse_input_version ('until-perl');
3027230276
const with_devel = core.getInput('with-devel') == "true";
3027330277

3027430278
let filtered = available.filter(
@@ -30278,7 +30282,7 @@ try {
3027830282
}
3027930283
const version = semver.coerce(item);
3028030284
const meetsLowerBound = semver.gte(version, since_perl);
30281-
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
30285+
const meetsUpperBound = !until_perl || semver.lte(version, until_perl);
3028230286
return meetsLowerBound && meetsUpperBound;
3028330287
}
3028430288
);

index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ let available = [
1010
"devel",
1111
];
1212

13+
function parse_input_version (input_name) {
14+
// semver.coerce() returns null for both empty string and null inputs
15+
return semver.coerce (core.getInput (input_name));
16+
}
17+
1318
try {
14-
const since_perl = semver.coerce(core.getInput('since-perl'));
15-
const to_perl_input = core.getInput('to-perl');
16-
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
19+
const since_perl = parse_input_version ('since-perl');
20+
const until_perl = parse_input_version ('until-perl');
1721
const with_devel = core.getInput('with-devel') == "true";
1822

1923
let filtered = available.filter(
@@ -23,7 +27,7 @@ try {
2327
}
2428
const version = semver.coerce(item);
2529
const meetsLowerBound = semver.gte(version, since_perl);
26-
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
30+
const meetsUpperBound = !until_perl || semver.lte(version, until_perl);
2731
return meetsLowerBound && meetsUpperBound;
2832
}
2933
);

0 commit comments

Comments
 (0)