Skip to content

Commit 572e600

Browse files
committed
Try to enable coverage in playwright testing
1 parent a118da8 commit 572e600

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,49 @@ jobs:
6868
steps:
6969
- uses: actions/checkout@v4
7070
- name: Build test image
71-
id: docker-build-test
71+
id: docker-build-playwright
7272
uses: docker/build-push-action@v6
7373
with:
74-
target: server
74+
target: playwright
7575
push: false
7676
load: true
77-
- name: Run Perl tests
77+
- name: Start playwright server
78+
id: start-container
7879
run: >
79-
docker run -d -i -p 8000:80
80-
${{ steps.docker-build-test.outputs.imageid }}
80+
CONTAINER_ID=$(docker run -d -i -p 8000:80
81+
-v $(pwd):/app
82+
${{ steps.docker-build-playwright.outputs.imageid }})
83+
&& echo "container_id=$CONTAINER_ID" >> $GITHUB_OUTPUT
84+
|| (echo "Failed to start container" && exit 1)
8185
- uses: actions/setup-node@v4
8286
with:
8387
node-version: 22
8488
- name: Install Playwright Browsers
8589
run: ./bin/install-playwright
90+
- name: Install Codecovbash
91+
uses: perl-actions/install-with-cpm@v1
92+
with:
93+
install: |
94+
Devel::Cover
95+
Devel::Cover::Report::Codecovbash
96+
sudo: true
97+
- name: Check docker status
98+
id: playwright-tests
99+
run: |
100+
npx playwright test || {
101+
echo "Playwright tests failed"
102+
docker logs ${{ steps.start-container.outputs.container_id }}
103+
exit 1
104+
}
86105
- name: Run Playwright tests
87106
run: npx playwright test
107+
- name: Generate Codecov report
108+
run: cover -report codecovbash
109+
- uses: codecov/codecov-action@v5
110+
with:
111+
fail_ci_if_error: true
112+
file: ./cover_db/codecov.json
113+
token: ${{ secrets.CODECOV_TOKEN }}
88114
test:
89115
runs-on: ubuntu-24.04
90116
name: Dockerless

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,18 @@ CMD [ "prove", "-l", "-r", "-j", "2", "t" ]
123123
FROM server AS production
124124

125125
USER metacpan
126+
127+
################### Playwright Server
128+
FROM server AS playwright
129+
USER root
130+
131+
RUN \
132+
--mount=type=cache,target=/root/.perl-cpm \
133+
<<EOT
134+
cpm install --show-build-log-on-failure Devel::Cover
135+
EOT
136+
137+
ENV HARNESS_ACTIVE=1
138+
ENV PERL5OPT='-MDevel::Cover=+ignore,^local/|^templates/|^t/|yaml$'
139+
140+
USER metacpan

0 commit comments

Comments
 (0)