From 52fa05f1ecb03e113522dfdbd0e84034b62e843a Mon Sep 17 00:00:00 2001 From: lyrakisk <24938740+lyrakisk@users.noreply.github.com> Date: Wed, 9 Oct 2024 20:05:47 +0200 Subject: [PATCH] Create docker image for the pipeline --- .github/actions/docker.yml | 12 ++++++++++++ .github/workflows/ci.yml | 14 ++++++++++---- docker/Dockerfile | 12 ++++++++++++ docker/entrypoint.sh | 6 ++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .github/actions/docker.yml create mode 100644 docker/Dockerfile create mode 100644 docker/entrypoint.sh diff --git a/.github/actions/docker.yml b/.github/actions/docker.yml new file mode 100644 index 0000000..3be28b9 --- /dev/null +++ b/.github/actions/docker.yml @@ -0,0 +1,12 @@ +name: 'Docker' +description: 'Installs dependencies in a docker container that will be used in workflows' +runs: + using: 'docker' + image: './docker/Dockerfile' + args: + - ${{ inputs.script }} + +inputs: + script: + description: 'The script to run inside the container.' + required: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f58601..85a2961 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,13 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + # - name: Build + # run: cargo build --verbose + # - name: Run tests + # run: cargo test --verbose + - name: Test + uses: ./actions/docker.yml + with: + script: | + cargo build --verbose + cargo test --verbose \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..aa30c64 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,12 @@ +# ubuntu 22.04 +FROM ubuntu@sha256:3d1556a8a18cf5307b121e0a98e93f1ddf1f3f8e092f1fddfd941254785b95d7 + +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -qy --no-install-recommends \ + libsdl2-dev + +COPY entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..e55f6c1 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +SCRIPT=$1 + +eval "$SCRIPT"