From 803937466ba665ad5260ba132b1c77975534ff7e Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Mon, 28 Oct 2024 16:42:15 +0000 Subject: [PATCH] Split Docker build workflow for gcc and intel --- .github/workflows/docker_gcc.yml | 57 +++++++++++++++++++ .../{docker.yml => docker_intel.yml} | 10 ++-- 2 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker_gcc.yml rename .github/workflows/{docker.yml => docker_intel.yml} (89%) diff --git a/.github/workflows/docker_gcc.yml b/.github/workflows/docker_gcc.yml new file mode 100644 index 0000000..556b6ef --- /dev/null +++ b/.github/workflows/docker_gcc.yml @@ -0,0 +1,57 @@ +name: Periodic Docker build with GCC + +on: + # Build the Docker container whenever commits are pushed to an open PR (under conditions defined below) + pull_request: + + # Build the Docker container at 00:00 on the first day of every 3 months + schedule: + - cron: '0 0 1 */3 *' + +jobs: + docker: + name: Build Docker container + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout the repo + id: Checkout + uses: actions/checkout@v4 + + - name: Determine if this file changed compared with develop + if: ${{ !(github.event_name == 'schedule') }} + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files: | + .github/workflows/docker_gcc.yml + docker/Dockerfile.gcc + docker/spack_gcc.yaml + base_sha: develop + + - name: Setup Docker buildx + id: buildx + if: ${{ (steps.changed-files.outputs.any_changed == 'true') || (github.event_name == 'schedule') }} + uses: docker/setup-buildx-action@v3 + + - name: Log into GitHub Container Repository + id: login + if: ${{ (steps.changed-files.outputs.any_changed == 'true') || ( github.event_name == 'schedule') }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + logout: true + + - name: Build container and push to ghcr + id: build-and-push + if: ${{ (steps.changed-files.outputs.any_changed == 'true') || (github.event_name == 'schedule') }} + uses: docker/build-push-action@v5 + with: + push: true + no-cache: true + file: docker/Dockerfile.gcc + tags: ghcr.io/fetch4/giss-gc-dev-env-gcc:latest diff --git a/.github/workflows/docker.yml b/.github/workflows/docker_intel.yml similarity index 89% rename from .github/workflows/docker.yml rename to .github/workflows/docker_intel.yml index e675108..d7704b5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker_intel.yml @@ -1,4 +1,4 @@ -name: Periodic Docker build +name: Periodic Docker build with Intel on: # Build the Docker container whenever commits are pushed to an open PR (under conditions defined below) @@ -26,9 +26,9 @@ jobs: uses: tj-actions/changed-files@v44 with: files: | - .github/workflows/docker.yml - docker/Dockerfile.devenv - docker/spack.yaml + .github/workflows/docker_intel.yml + docker/Dockerfile.intel + docker/spack_intel.yaml base_sha: develop - name: Setup Docker buildx @@ -53,5 +53,5 @@ jobs: with: push: true no-cache: true - file: docker/Dockerfile.devenv + file: docker/Dockerfile.intel tags: ghcr.io/fetch4/giss-gc-dev-env:latest