Skip to content

Merge pull request #3219 from metacpan/update-cpanfile-snapshot #2118

Merge pull request #3219 from metacpan/update-cpanfile-snapshot

Merge pull request #3219 from metacpan/update-cpanfile-snapshot #2118

Workflow file for this run

---
name: test
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
code-formatting:
runs-on: ubuntu-22.04
name: Code Formatting
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch base ref
if: ${{ github.event.pull_request }}
run: git fetch origin ${{ github.base_ref }}:upstream
- run: npm install
- name: Install Carton
uses: perl-actions/install-with-cpm@v1
with:
install: Carton
- name: Install CPAN deps
uses: perl-actions/install-with-cpm@v1
with:
cpanfile: 'cpanfile'
args: >
--resolver=snapshot
--without-runtime
--without-test
--without-build
--with-develop
- name: Install precious
run: ./bin/install-precious /usr/local/bin
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Select files
id: select-files
run: |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
echo 'precious-args=--git-diff-from upstream' >> "$GITHUB_OUTPUT"
else
echo 'precious-args=--all' >> "$GITHUB_OUTPUT"
fi
- name: Lint files
run: precious lint ${{ steps.select-files.outputs.precious-args }}
docker:
runs-on: ubuntu-22.04
name: Docker
steps:
- name: Build test image
id: docker-build-test
uses: docker/build-push-action@v6
with:
target: test
push: false
load: true
- name: Run Perl tests
run: docker run -i ${{ steps.docker-build-test.outputs.imageid }}
test:
runs-on: ubuntu-20.04
name: Dockerless
strategy:
fail-fast: false
matrix:
perl-version:
- '5.36'
resolver:
- snapshot
- metacpan
container:
image: perl:${{ matrix.perl-version }}
env:
DEVEL_COVER_OPTIONS: '+ignore,^local/,^t/'
steps:
- name: Enable coverage
id: coverage
if: >
matrix.resolver == 'snapshot'
&& github.event.pull_request.user.login != 'dependabot[bot]'
run: echo "enabled=1" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm install
- run: apt-get update && apt-get -y install libcmark-dev
- name: Install Carton
uses: perl-actions/install-with-cpm@v1
with:
install: Carton
sudo: false
- name: Install CPAN deps
uses: perl-actions/install-with-cpm@v1
with:
cpanfile: 'cpanfile'
sudo: false
args: >
--resolver ${{ matrix.resolver }}
- name: Build assets
run: npm run build
- name: Install Codecovbash
if: steps.coverage.outputs.enabled
uses: perl-actions/install-with-cpm@v1
with:
install: |
Devel::Cover
Devel::Cover::Report::Codecovbash
sudo: false
- name: Enable coverage
if: steps.coverage.outputs.enabled
run: echo "HARNESS_PERL_SWITCHES=-MDevel::Cover" >> "$GITHUB_ENV"
- name: Run tests
run: carton exec prove -lr --jobs 2 t
- name: Generate Codecov report
if: steps.coverage.outputs.enabled
run: cover -report codecovbash
- uses: codecov/codecov-action@v4
if: steps.coverage.outputs.enabled
with:
fail_ci_if_error: true
file: ./cover_db/codecov.json
token: ${{ secrets.CODECOV_TOKEN }}