build and test #543
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: build and test | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup Perl | |
id: perl | |
uses: shogo82148/actions-setup-perl@v1 | |
- name: Get build timestamp | |
run: echo BUILD_TIMESTAMP="$(date +%FT%T)" >> $GITHUB_ENV | |
- name: Cache build dependencies | |
uses: actions/cache@v4 | |
with: | |
path: local | |
key: cache-build-deps-${{ steps.perl.outputs.perl-hash }}-${{ env.BUILD_TIMESTAMP }} | |
restore-keys: cache-build-deps-${{ steps.perl.outputs.perl-hash }}- | |
- name: Install Dist::Zilla | |
run: cpm install --show-build-log-on-failure Dist::Zilla | |
- name: Install author dependencies | |
run: dzil authordeps | cpm install --show-build-log-on-failure - | |
- name: Build dist | |
run: dzil build --no-tgz --in build | |
- name: Create build tarball | |
run: tar cvf build.tar -C build . | |
- name: Upload build results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build.tar | |
path: build.tar | |
coverage: | |
if: ${{ github.event_name != 'schedule' }} | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Download build results | |
uses: actions/download-artifact@v4 | |
with: | |
name: build.tar | |
- name: Extract tarball | |
run: tar xvf build.tar | |
- name: Setup Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
install-modules-with: cpm | |
install-modules-args: --with-develop | |
install-modules: Devel::Cover::Report::Coveralls | |
- name: Run tests with coverage | |
env: | |
HARNESS_PERL_SWITCHES: -MDevel::Cover=+ignore,^local/ | |
run: prove --timer --lib --recurse --jobs $(nproc) --shuffle t/ | |
- name: Report coverage info to Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: cover -report coveralls | |
extra-tests: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
AUTHOR_TESTING: 1 | |
EXTENDED_TESTING: 1 | |
RELEASE_TESTING: 1 | |
steps: | |
- name: Download build results | |
uses: actions/download-artifact@v4 | |
with: | |
name: build.tar | |
- name: Extract tarball | |
run: tar xvf build.tar | |
- name: Setup Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
install-modules-with: cpm | |
install-modules-args: --with-develop | |
- name: Run extra tests | |
run: prove --timer --lib --recurse --jobs $(nproc) --shuffle xt | |
tests: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
- macos | |
perl: | |
- 5.12 | |
- latest | |
distribution: | |
- default | |
threaded: | |
- false | |
include: | |
- os: ubuntu | |
perl: latest | |
distribution: default | |
threaded: true | |
- os: macos | |
perl: latest | |
distribution: default | |
threaded: true | |
- os: windows | |
perl: latest | |
distribution: strawberry | |
threaded: true | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Download build results | |
uses: actions/download-artifact@v4 | |
with: | |
name: build.tar | |
- name: Extract tarball | |
run: tar xvf build.tar | |
- name: Setup Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: ${{ matrix.perl }} | |
distribution: ${{ matrix.distribution }} | |
multi-thread: ${{ matrix.threaded }} | |
install-modules-with: cpm | |
- name: Get number of processors | |
id: cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
- name: Run tests | |
run: prove --timer --lib --recurse --jobs ${{ steps.cores.outputs.count }} --shuffle t |