From 621ed36edf379d8aebff51bd05fe2939fec620d9 Mon Sep 17 00:00:00 2001 From: Gordon Julian Koehn Date: Fri, 22 Nov 2024 13:40:07 +0100 Subject: [PATCH] fix: docker mount / feat: add docker build test (#41) * fix: docker mount paths should by default point to the test data * add docker test and push * add docker test and push * add docker test and push --- .github/workflows/docker-build-test.yml | 51 +++++++++++++++++++++++++ docker-compose.env | 4 +- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-build-test.yml diff --git a/.github/workflows/docker-build-test.yml b/.github/workflows/docker-build-test.yml new file mode 100644 index 0000000..af08246 --- /dev/null +++ b/.github/workflows/docker-build-test.yml @@ -0,0 +1,51 @@ +name: Docker Build and Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + docker-compose --version + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and test Docker image + run: docker-compose --env-file docker-compose.env up --build --exit-code-from sr2silo + + - name: Push to DockerHub + if: github.ref == 'refs/heads/main' + run: | + docker-compose push diff --git a/docker-compose.env b/docker-compose.env index c405504..261ea9f 100644 --- a/docker-compose.env +++ b/docker-compose.env @@ -1,7 +1,7 @@ -SAMPLE_DIR=../../../data/sr2silo/daemon_test/samples/A1_05_2024_10_08/20241024_2411515907/alignments/ +SAMPLE_DIR=./tests/data/samples/A1_05_2024_10_08/20241024_2411515907/alignments SAMPLE_ID=A1_05_2024_10_08 BATCH_ID=20241024_2411515907 -TIMELINE_FILE=../../../data/sr2silo/daemon_test/timeline.tsv +TIMELINE_FILE=./tests/data/samples/timeline_A1_05_2024_10_08.tsv PRIMER_FILE=./tests/data/samples/primers.yaml NEXTCLADE_REFERENCE=sars-cov2 RESULTS_DIR=./results