Skip to content

Commit e1ae760

Browse files
ErikSchierboomBethanyG
authored andcommitted
Update GHA test workflow to run tests in Docker
1 parent d963aaa commit e1ae760

File tree

4 files changed

+20
-56
lines changed

4 files changed

+20
-56
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
Dockerfile
88
bin/run-in-docker.sh
99
bin/run-tests-in-docker.sh
10-
bin/run-tests.sh
1110
test/

.github/workflows/main.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,25 @@ on:
1313
jobs:
1414
build:
1515
name: Test Runner
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717
steps:
18-
- uses: actions/checkout@v1
18+
- name: Checkout code
19+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
1920

20-
- name: Build Docker Image
21-
run: docker build -f Dockerfile -t python-test-runner .
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
23+
with:
24+
install: true
2225

23-
- name: Run Tests
24-
run: docker run --entrypoint pytest python-test-runner -vv
26+
- name: Build Docker image and store in cache
27+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
28+
with:
29+
context: .
30+
push: false
31+
load: true
32+
tags: exercism/python-test-runner
33+
cache-from: type=gha
34+
cache-to: type=gha,mode=max
35+
36+
- name: Run Tests in Docker
37+
run: bin/run-tests-in-docker.sh

bin/run-tests-in-docker.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ docker run \
2525
--read-only \
2626
--mount type=bind,src="${PWD}/test",dst=/opt/test-runner/test \
2727
--mount type=volume,dst=/tmp \
28-
--volume "${PWD}/bin/run-tests.sh:/opt/test-runner/bin/run-tests.sh" \
2928
--workdir /opt/test-runner \
30-
--entrypoint /opt/test-runner/bin/run-tests.sh \
29+
--entrypoint pytest \
3130
exercism/python-test-runner

bin/run-tests.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)