Skip to content

Commit

Permalink
Add debugging output if test fail and also try caching
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdoupe committed Sep 1, 2023
1 parent 3f4e05d commit e14ad16
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,37 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Build Container
run: "docker build -t pwncollege/dojo ."
- name: Set up Docker Buildx
id: buildx
# Use the action from the master, as we've seen some inconsistencies with @v1
# Issue: https://github.com/docker/build-push-action/issues/286
uses: docker/setup-buildx-action@master
# It only worked for us with this option on 🤷‍♂️
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx
- name: Build container
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
# Set the desired build target here
target: deploy
push: false
tags: pwncollege/dojo
cache-from: type=local,src=/tmp/.buildx-cache
# Note the mode=max here
# More: https://github.com/moby/buildkit#--export-cache-options
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Run Container
run: "docker run --privileged -d -v $PWD:/opt/pwn.college:shared -p 2222:22 -p 80:80 -p 443:443 --name dojo pwncollege/dojo"
- name: Wait for container to be ready
Expand All @@ -21,6 +50,8 @@ jobs:
docker exec dojo journalctl -u pwn.college | tail -n 5
done
- name: Run tests against container
run: "pytest ./test"
run: |
pytest ./test || docker exec dojo journalctl -u pwn.college

0 comments on commit e14ad16

Please sign in to comment.