Skip to content

Commit deb07cd

Browse files
authored
Merge pull request #3046 from metacpan/haarg/fix-build-workflows
fix build workflows to run tests properly with new Dockerfile setup
2 parents 89dfcad + bd5343a commit deb07cd

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

.github/workflows/build-deployment-container.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ jobs:
1212
name: Docker Push
1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Docker build
16-
run: docker build . -t metacpan/metacpan-web:$GITHUB_SHA
17-
- name: Run Perl tests
18-
run: docker run -i metacpan/metacpan-web carton exec prove -lr --jobs 2 t
1915
- name: Log in to Docker Hub
2016
uses: docker/login-action@v3
2117
with:
2218
username: ${{ secrets.DOCKER_HUB_USER }}
2319
password: ${{ secrets.DOCKER_HUB_TOKEN }}
24-
- name: Push build to Docker hub
25-
run: docker push metacpan/metacpan-web:$GITHUB_SHA
20+
- name: Build test image
21+
- uses: docker/build-push-action@v2
22+
with:
23+
tags: metacpan/metacpan-web:test
24+
target: test
25+
push: false
26+
- name: Run Perl tests
27+
run: docker run -i metacpan/metacpan-web:test
28+
- name: Build and push
29+
uses: docker/build-push-action@v5
30+
with:
31+
push: true
32+
tags: metacpan/metacpan-web:$GITHUB_SHA

.github/workflows/build-production-container.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ jobs:
1111
name: Docker Push
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: docker build
15-
run: docker build . -t metacpan/metacpan-web:latest -t metacpan/metacpan-web:$GITHUB_SHA
16-
- name: run Perl tests
17-
run: docker run -i metacpan/metacpan-web carton exec prove -lr --jobs 2 t
1814
- name: Log in to Docker Hub
1915
uses: docker/login-action@v3
2016
with:
2117
username: ${{ secrets.DOCKER_HUB_USER }}
2218
password: ${{ secrets.DOCKER_HUB_TOKEN }}
23-
- name: Push build to Docker Hub
24-
run: docker push --all-tags metacpan/metacpan-web
19+
- name: Build test image
20+
- uses: docker/build-push-action@v2
21+
with:
22+
tags: metacpan/metacpan-web:test
23+
target: test
24+
push: false
25+
- name: Run Perl tests
26+
run: docker run -i metacpan/metacpan-web:test
27+
- name: Build and push
28+
uses: docker/build-push-action@v5
29+
with:
30+
push: true
31+
tags: metacpan/metacpan-web:latest,metacpan/metacpan-web:$GITHUB_SHA

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ COPY .perlcriticrc .perltidyrc perlimports.toml tidyall.ini ./
124124
COPY t t
125125

126126
USER metacpan
127-
CMD [ "prove", "-lr", "t" ]
127+
CMD [ "prove", "-l", "-r", "-j", "2", "t" ]
128128

129129
################### Production Server
130130
FROM server AS production

0 commit comments

Comments
 (0)