Skip to content

Rename to-perl to until-perl #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 53 additions & 95 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,108 +3,66 @@ name: "Check Workflow"
on: [push, pull_request]

jobs:

since-v520:
test-action:
runs-on: ubuntu-latest
name: 'since v5.20'
outputs:
perl-versions: ${{ steps.action.outputs.perl-versions }}
steps:
- uses: actions/checkout@v4
- name: "uses perl-versions"
id: action
uses: ./
with:
since-perl: v5.20
strategy:
matrix:
include:
- job-id: since-v520
name: "Since v5.20"
since-perl: "v5.20"
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"]'

since-520:
runs-on: ubuntu-latest
name: 'since 5.20'
outputs:
perl-versions: ${{ steps.action.outputs.perl-versions }}
steps:
- uses: actions/checkout@v4
- name: "uses perl-versions"
id: action
uses: ./
with:
since-perl: "5.20"
- job-id: since-520
name: "Since 5.20"
since-perl: "5.20"
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"]'

since-536-with-devel:
runs-on: ubuntu-latest
name: 'since 5.36 with devel'
outputs:
perl-versions: ${{ steps.action.outputs.perl-versions }}
steps:
- uses: actions/checkout@v4
- name: "uses perl-versions"
id: action
uses: ./
with:
since-perl: 5.36
with-devel: true
- job-id: since-536-with-devel
name: "Since 5.36 with devel"
since-perl: "5.36"
with-devel: "true"
expected: '["5.36","5.38","5.40","5.42","devel"]'

since-524-to-532:
runs-on: ubuntu-latest
name: 'since 5.24 to 5.32'
outputs:
perl-versions: ${{ steps.action.outputs.perl-versions }}
steps:
- uses: actions/checkout@v4
- name: "uses perl-versions"
id: action
uses: ./
with:
since-perl: "5.24"
to-perl: "5.32"
- job-id: since-524-to-532
name: "Since 5.24 until 5.32"
since-perl: "5.24"
until-perl: "5.32"
expected: '["5.24","5.26","5.28","5.30","5.32"]'

test-matrix:
runs-on: ubuntu-latest
needs:
- since-536-with-devel
strategy:
fail-fast: false
matrix:
perl-versions: ${{ fromJson (needs.since-536-with-devel.outputs.perl-versions) }}
steps:
- run: echo "Hello"
- job-id: with-devel-and-until
name: "With devel and until-perl"
since-perl: "5.36"
until-perl: "5.40"
with-devel: "true"
expected: '["5.36","5.38","5.40","devel"]'

perl-tester:
runs-on: ubuntu-latest
needs:
- since-536-with-devel
name: "Perl ${{ matrix.perl-version }}"
strategy:
fail-fast: false
matrix:
perl-version: ${{ fromJson (needs.since-536-with-devel.outputs.perl-versions) }}
container:
image: perldocker/perl-tester:${{ matrix.perl-version }}
steps:
- uses: actions/checkout@v4
- run: perl -V
- job-id: single-version
name: "Single version"
since-perl: "5.32"
until-perl: "5.32"
expected: '["5.32"]'

check:
needs:
- since-v520
- since-520
- since-536-with-devel
- since-524-to-532
runs-on: ubuntu-latest
steps:
- job-id: oldest-supported
name: "Oldest supported version is 5.8"
since-perl: "5.6"
until-perl: "5.14"
expected: '["5.8","5.10","5.12","5.14"]'

- name: "Testing since-v520"
run: |
[[ '${{ 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"

- name: "Testing since-520"
run: |
[[ '${{ 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"
steps:
- uses: actions/checkout@v4

- name: "Testing since-536-with-devel"
run: |
[[ '${{ needs.since-536-with-devel.outputs.perl-versions }}' == '["5.36","5.38","5.40","5.42","devel"]' ]] && echo "ok"
- name: "Call action - ${{ matrix.name }}"
id: call-action
uses: ./
with:
since-perl: ${{ matrix.since-perl }}
until-perl: ${{ matrix.until-perl || null }}
with-devel: ${{ matrix.with-devel || null }}

- name: "Testing since-524-to-532"
run: |
[[ '${{ needs.since-524-to-532.outputs.perl-versions }}' == '["5.24","5.26","5.28","5.30","5.32"]' ]] && echo "ok"
- name: Validate output - ${{ matrix.name }}
uses: prompt/actions-assert@v4
with:
assertion: npm://@assertions/is-equal:v1
actual: ${{ steps.call-action.outputs.perl-versions }}
expected: ${{ matrix.expected }}
11 changes: 11 additions & 0 deletions .github/workflows/perl-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ on:
type: string
required: true
default: "5.10"
until-perl:
description: "List all Perl versions up to this (including this). Example: 5.30"
type: string
required: false
with-devel:
description: "Whether to include also 'devel' Perl"
type: boolean
required: false
default: false
outputs:
perl-versions:
value: ${{ jobs.perl-versions.outputs.perl-versions }}
Expand All @@ -24,4 +33,6 @@ jobs:
uses: perl-actions/perl-versions@main
with:
since-perl: ${{ inputs.since-perl }}
until-perl: ${{ inputs.until-perl || null }}
with-devel: ${{ inputs.with-devel || null }}

2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
description: "List all Perl versions since this (including this). Example: 5.10"
type: string
required: true
to-perl:
until-perl:
description: "List all Perl versions up to this (including this). Example: 5.30"
type: string
required: false
Expand Down
12 changes: 8 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30265,10 +30265,14 @@ let available = [
"devel",
];

function parse_input_version (input_name) {
// semver.coerce() returns null for both empty string and null inputs
return semver.coerce (core.getInput (input_name));
}

try {
const since_perl = semver.coerce(core.getInput('since-perl'));
const to_perl_input = core.getInput('to-perl');
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
const since_perl = parse_input_version ('since-perl');
const until_perl = parse_input_version ('until-perl');
const with_devel = core.getInput('with-devel') == "true";

let filtered = available.filter(
Expand All @@ -30278,7 +30282,7 @@ try {
}
const version = semver.coerce(item);
const meetsLowerBound = semver.gte(version, since_perl);
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
const meetsUpperBound = !until_perl || semver.lte(version, until_perl);
return meetsLowerBound && meetsUpperBound;
}
);
Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ let available = [
"devel",
];

function parse_input_version (input_name) {
// semver.coerce() returns null for both empty string and null inputs
return semver.coerce (core.getInput (input_name));
}

try {
const since_perl = semver.coerce(core.getInput('since-perl'));
const to_perl_input = core.getInput('to-perl');
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
const since_perl = parse_input_version ('since-perl');
const until_perl = parse_input_version ('until-perl');
const with_devel = core.getInput('with-devel') == "true";

let filtered = available.filter(
Expand All @@ -23,7 +27,7 @@ try {
}
const version = semver.coerce(item);
const meetsLowerBound = semver.gte(version, since_perl);
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
const meetsUpperBound = !until_perl || semver.lte(version, until_perl);
return meetsLowerBound && meetsUpperBound;
}
);
Expand Down