Skip to content

Commit

Permalink
Cache eating up all the disk, so impossible to test.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdoupe committed Sep 1, 2023
1 parent 7870150 commit 1ecb548
Showing 1 changed file with 50 additions and 34 deletions.
84 changes: 50 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,53 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pytest
- 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: 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@v3
# with:
# path: /tmp/.buildx-cache
# # Key is named differently to avoid collision
# key: ${{ runner.os }}-multi-buildx-outer-${{ 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
# push: false
# load: true # we want this tag to be loaded to docker images
# tags: dojo-test
# 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/blob/master/docs/reference/buildx_build.md#cache-to
# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# - name: Move outer cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# - name: Cache inner container docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache-inner
# # Key is named differently to avoid collision
# key: ${{ runner.os }}-multi-buildx-inner-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-multi-buildx-inner
- name: Build container
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
# Set the desired build target here
push: false
load: true # we want this tag to be loaded to docker images
tags: dojo-test
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/blob/master/docs/reference/buildx_build.md#cache-to
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
run:
docker build -t dojo-test .

- 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 dojo-test"
- name: Wait for container to be ready
Expand All @@ -58,6 +70,10 @@ jobs:
sleep 5
docker exec dojo journalctl -u pwn.college | tail -n 5
done
# - name: Move inner cache
# run: |
# rm -rf /tmp/.buildx-cache-inner
# mv /tmp/.buildx-cache-inner-new /tmp/.buildx-cache-inner
- name: Run tests against container
run: |
docker exec dojo docker compose logs
Expand Down

0 comments on commit 1ecb548

Please sign in to comment.