bump pkgcraft-c compat #270
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: ['**'] | |
paths: | |
- "lib/**" | |
- "t/**" | |
- "testdata/**" | |
- "Makefile.PL" | |
- ".github/workflows/ci.yml" | |
pull_request: | |
branches: [main] | |
paths: | |
- "lib/**" | |
- "t/**" | |
- "testdata/**" | |
- "Makefile.PL" | |
workflow_dispatch: | |
inputs: | |
perl-version: | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
perl-version: | |
required: false | |
type: string | |
event-type: | |
required: true | |
type: string | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
perl-version: ${{ steps.vars.outputs.perl-version }} | |
steps: | |
- name: Checkout code to determine the minimum supported perl version | |
if: ${{ inputs.perl-version == '' }} | |
uses: actions/checkout@v4 | |
with: | |
repository: pkgcraft/pkgcraft-perl | |
- name: Set perl versions to test against | |
id: vars | |
run: | | |
if [[ -n "${{ inputs.perl-version }}" ]]; then | |
echo "perl-version=$(jq 'split(",")' -Rc <(echo '${{ inputs.perl-version }}'))" >> $GITHUB_OUTPUT | |
else | |
min_ver=$(sed -rn "/^\s*MIN_PERL_VERSION / s/.*=> '([0-9](.[0-9]+)*)',/\1/p" Makefile.PL) | |
if [[ -n ${min_ver} ]]; then | |
echo "perl-version=['${min_ver}', '5']" >> $GITHUB_OUTPUT | |
else | |
exit 1 | |
fi | |
fi | |
test: | |
needs: setup | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
perl-version: ${{ fromJson(needs.setup.outputs.perl-version) }} | |
steps: | |
- name: Set up environment | |
run: echo pkgcraft_dir=~/pkgcraft >> $GITHUB_ENV | |
- name: Download pkgcraft-c library from most recent run | |
if: ${{ inputs.event-type == '' }} | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
github_token: ${{ secrets.PKGCRAFT_CI_TOKEN }} | |
repo: pkgcraft/pkgcraft | |
branch: main | |
workflow: pkgcraft-c.yml | |
workflow_conclusion: "" | |
search_artifacts: true | |
name: pkgcraft-c-${{ runner.os }} | |
- name: Download pkgcraft-c library from running workflow | |
if: ${{ inputs.event-type != '' }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: pkgcraft-c-${{ runner.os }} | |
- name: Unpack library | |
run: | | |
mkdir -p "${pkgcraft_dir}" | |
tar -Jxf pkgcraft-c.tar.xz -C "${pkgcraft_dir}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
repository: pkgcraft/pkgcraft-perl | |
submodules: true | |
- name: Set up Perl ${{ matrix.perl-version }} | |
uses: shogo82148/actions-setup-perl@v1 | |
id: perl | |
with: | |
perl-version: ${{ matrix.perl-version }} | |
enable-modules-cache: false | |
- name: Set up cache | |
uses: actions/cache@v4 | |
with: | |
path: local | |
key: ${{ github.job }}-${{ runner.os }}-perl-${{ steps.perl.outputs.perl-version }}-${{ hashFiles('Makefile.PL') }} | |
restore-keys: ${{ github.job }}-${{ runner.os }}-perl-${{ steps.perl.outputs.perl-version }}- | |
- name: Install modules | |
run: | | |
cpanm -L local -n --installdeps . | |
cpanm -L local -n Devel::Cover | |
# required for `cover` command to be found | |
echo local/bin >> $GITHUB_PATH | |
- name: Override build variables | |
run: | | |
echo "PKG_CONFIG_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
echo "DYLD_LIBRARY_PATH=${pkgcraft_dir}" >> $GITHUB_ENV | |
- name: Build and test module | |
env: | |
PERL5LIB: 'perllib:local/lib/perl5' | |
run: | | |
perl Makefile.PL | |
make | |
cover -test -ignore_re "local" -report codecov | |
- name: Upload coverage to Codecov | |
if: ${{ inputs.event-type == '' && github.ref_name == 'main' && matrix.perl-version == '5' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.json |