-
Notifications
You must be signed in to change notification settings - Fork 237
128 lines (127 loc) · 3.62 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
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@v5
if: steps.coverage.outputs.enabled
with:
fail_ci_if_error: true
file: ./cover_db/codecov.json
token: ${{ secrets.CODECOV_TOKEN }}