-
Notifications
You must be signed in to change notification settings - Fork 236
104 lines (103 loc) · 3.08 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
---
name: test
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-22.04
name: Docker
steps:
- uses: actions/checkout@v4
- name: docker build
run: docker build . --target test -t metacpan/metacpan-web:latest
- name: run Perl tests
run: >
docker run -i metacpan/metacpan-web
carton exec prove -lr --jobs 2 t
test:
runs-on: ubuntu-20.04
name: Dockerless
strategy:
fail-fast: false
matrix:
perl-version:
- '5.30'
resolver:
- snapshot
- metacpan
container:
image: perl:${{ matrix.perl-version }}
env:
DEVEL_COVER_OPTIONS: '-ignore,^local/'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
if: matrix.resolver == 'snapshot'
- uses: actions/checkout@v4
if: matrix.resolver != 'snapshot'
- uses: actions/setup-node@v4
with:
node-version: '18'
- 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 }}
--show-build-log-on-failure
--local-lib-contained=local
- name: Build assets
run: npm run build
- name: Run tests without coverage
if: matrix.resolver != 'snapshot'
run: carton exec prove -lr --jobs 2 t
env:
TEST_TIDYALL_VERBOSE: 1
- name: Install Codecovbash
if: matrix.resolver == 'snapshot'
uses: perl-actions/install-with-cpm@v1
with:
install: |
Devel::Cover
Devel::Cover::Report::Codecov
Devel::Cover::Report::Codecovbash
sudo: false
- name: Run tests with coverage
if: matrix.resolver == 'snapshot'
run: carton exec prove -lr --jobs 2 t
env:
HARNESS_PERL_SWITCHES: -MDevel::Cover=+ignore,^t/
- name: Upload coverage reports to Codecov
if: matrix.resolver == 'snapshot'
run: cover -report codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Install precious
run: ./bin/install-precious /usr/local/bin
- name: Install perlimports
run: cpm install -g App::perlimports
if: matrix.resolver == 'snapshot'
- name: Fetch master
run: git fetch origin master:master
if: github.ref != 'refs/heads/master' && matrix.resolver == 'snapshot'
- name: Lint files in diff (branch)
run: precious lint -d master
if: github.ref != 'refs/heads/master' && matrix.resolver == 'snapshot'
- name: Lint all files (master)
run: precious lint --all
if: github.ref == 'refs/heads/master' && matrix.resolver == 'snapshot'