From dd6454065d05daffa7bc36e896dd7baec09c3e1d Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Fri, 11 Nov 2022 07:23:02 +0100 Subject: [PATCH] Merged #1351 PR: Run tests in docker images (#1370) * Added images to DockerFile * Docker test * Docker.yml changes, longer timeout and naming changes * typo in run command * added matrix for docker workflow 'testing' * typo in matrix * git fixes * docker testing * Changed stage build'testing' * testing docker change * Run images in seperate containers * docker files added * reverted Dockerfile * Removed files from the index (now ignored) * Docker test, changed build to pull * Update comments in Ubuntu and Debian dockerfiles * added main service back * Reducing common code * Condensing docker-compose.yml * Revert docker-compose.yml changes * Removing matrix from docker-compose.yml * removing target images from docker-compose * Added dockerfile-unitTests * Condensing docker-compose.yml * Reverting compose changes * Merged Dockerfiles and fixed image names * removed .DS_Store * Revert pycharm_debugging.md * Testing remove * Testing remove * Remove ds files * Add files via upload * Add files via upload * Docker changes * Docker workflow changes * Update Dockerfile * Update docker-compose.yml * shorten docker-compose.yml by using yaml anchors * fix docker-compose.yml Co-authored-by: Kevin Nguyen Co-authored-by: Filip Mazur <110886132+mazfil@users.noreply.github.com> Co-authored-by: KevinN318 <110944398+KevinN318@users.noreply.github.com> Co-authored-by: Filip Mazur --- .github/workflows/docker.yml | 25 ++++++++++++++++++------ Dockerfile | 4 +++- docker-compose.yml | 37 +++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a2b027c88..f24669987 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,13 +3,26 @@ on: [push, pull_request] jobs: docker: + strategy: + fail-fast: false + matrix: + images: [ubuntu18.04, ubuntu20.04, ubuntu22.04, debian10, debian11] + runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 + + - name: Cache for docker images + uses: satackey/action-docker-layer-caching@v0.0.11 + # Ignore the failure of a step and avoid terminating the job. + continue-on-error: true + with: + path: ~/.cache/images + key: ${{ matrix.images }}-cache-images - - name: Build the Docker image - run: docker-compose build main + - name: Docker Build ${{ matrix.images }} + run: docker-compose pull ${{ matrix.images }} - - name: Run the tests in Docker - run: docker-compose run main ./tests.sh + - name: Test on ${{ matrix.images }} + run: docker-compose run ${{ matrix.images }} ./tests.sh diff --git a/Dockerfile b/Dockerfile index 02715de6e..d1b196a28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,9 @@ # For development, mount the directory so the host changes are reflected into container: # docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v `pwd`:/pwndbg pwndbg bash # -FROM ubuntu:20.04 + +ARG image=ubuntu:20.04 +FROM $image WORKDIR /pwndbg diff --git a/docker-compose.yml b/docker-compose.yml index 18381602a..637b9c7af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: "3.8" services: - main: + main: &base-spec build: . volumes: - .:/pwndbg @@ -9,3 +9,38 @@ services: - seccomp:unconfined cap_add: - SYS_PTRACE + + ubuntu18.04: + <<: *base-spec + build: + context: . + args: + image: ubuntu:18.04 + + ubuntu20.04: + <<: *base-spec + build: + context: . + args: + image: ubuntu:20.04 + + ubuntu22.04: + <<: *base-spec + build: + context: . + args: + image: ubuntu:22.04 + + debian10: + <<: *base-spec + build: + context: . + args: + image: debian:10 + + debian11: + <<: *base-spec + build: + context: . + args: + image: debian:11