From db72ff8497154657110a7b9214189c803eede1d7 Mon Sep 17 00:00:00 2001 From: Alexander Taepper Date: Thu, 14 Nov 2024 17:52:08 +0100 Subject: [PATCH] rewrite logic to use lewagon/wait-on-check-action instead --- .github/workflows/dependencies.yml | 4 ---- .github/workflows/imageAndTests.yml | 25 ++++++++++++++----------- .github/workflows/linter.yml | 19 +++++++++++++------ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 92d33bd4..1a303224 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -4,10 +4,6 @@ on: push: workflow_dispatch: -permissions: - contents: read - actions: write - env: DOCKER_DEPENDENCY_IMAGE_NAME: ghcr.io/genspectrum/lapis-silo-dependencies diff --git a/.github/workflows/imageAndTests.yml b/.github/workflows/imageAndTests.yml index 3e487ce3..038573cf 100644 --- a/.github/workflows/imageAndTests.yml +++ b/.github/workflows/imageAndTests.yml @@ -3,10 +3,6 @@ name: LAPIS-SILO on: push: -permissions: - contents: read - actions: write - concurrency: group: ci-${{ github.ref }} cancel-in-progress: true @@ -16,20 +12,27 @@ env: DOCKER_IMAGE_NAME: ghcr.io/genspectrum/lapis-silo jobs: + waitForDependencyImage: + name: Wait for dependency image + runs-on: ubuntu-latest + steps: + - name: Wait + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.ref }} + check-name: 'Build Docker Image Dependencies' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 3 + dockerImageUnitTests: name: Build Docker Image and Run Unit Tests runs-on: ubuntu-latest + needs: waitForDependencyImage permissions: packages: write steps: - uses: actions/checkout@v4 - - name: Generate dependency files hash - id: files-hash - run: | - DIR_HASH=$(echo -n ${{ hashFiles('conanfile.py', 'conanprofile.docker', '.github/workflows/ci.yml', './Dockerfile_dependencies') }}) - echo "DIR_HASH=$DIR_HASH" >> $GITHUB_ENV - - name: Docker metadata id: dockerMetadata uses: docker/metadata-action@v5 @@ -60,7 +63,7 @@ jobs: cache-from: type=gha,ref=${{ github.ref_name }}-image-cache cache-to: type=gha,mode=min,ref=${{ github.ref_name }}-image-cache build-args: | - DEPENDENCY_IMAGE=ghcr.io/genspectrum/lapis-silo-dependencies:${{ env.DIR_HASH }} + DEPENDENCY_IMAGE=${{ env.DOCKER_DEPENDENCY_IMAGE_NAME }}:commit-${{ github.sha }} - name: Run tests uses: addnab/docker-run-action@v3 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7747770b..449ef26e 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -2,10 +2,6 @@ name: Run Linter on: pull_request: - workflow_run: - workflows: [ "First Workflow" ] - types: - - completed concurrency: group: linter-${{ github.ref }} @@ -15,11 +11,22 @@ env: DOCKER_DEPENDENCY_IMAGE_NAME: ghcr.io/genspectrum/lapis-silo-dependencies jobs: + waitForDependencyImage: + name: Wait for dependency image + runs-on: ubuntu-latest + steps: + - name: Wait + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.ref }} + check-name: 'Build Docker Image Dependencies' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 3 + linter: name: Build And Run linter - needs: linterDependencies + needs: waitForDependencyImage runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && github.event_name == 'pull_request' }} env: PR_NUMBER: ${{ github.event.number }} container: