From 76313655370f7d17be9adc28947ae45a9e2ca988 Mon Sep 17 00:00:00 2001 From: Oksana Shadura Date: Fri, 9 Feb 2024 14:33:05 +0100 Subject: [PATCH] Update GH actions to support detection v0 versus calever version coffea and build relevant image instead --- .github/workflows/autotag.yaml | 2 +- .github/workflows/gh-ci.yaml | 54 +++++++++++++++++++++++------- .github/workflows/watch-conda.yaml | 3 +- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/.github/workflows/autotag.yaml b/.github/workflows/autotag.yaml index 4521afa..c1b2061 100644 --- a/.github/workflows/autotag.yaml +++ b/.github/workflows/autotag.yaml @@ -14,7 +14,7 @@ jobs: with: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" strategy: regex - regex_pattern: 'releasev0: \"\d+\.\d+\.\d+\"' + regex_pattern: 'releasev0: \"0.\d+\.\d+\"' root: ".github/workflows/gh-ci.yml" - uses: butlerlogic/action-autotag@stable with: diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index f9daeba..7b4cbcb 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -12,7 +12,7 @@ env: DOCKER_ORG: coffeateam GITHUB_SHA: ${{ github.sha }} GITHUB_REF: ${{ github.ref }} - release: "0.7.22" + release: "2024.1.0" releasev0: "0.7.22" jobs: @@ -21,11 +21,11 @@ jobs: strategy: fail-fast: false matrix: - image_dir: [basev0, dask] + image_dir: [coffea-basev0, coffea-dask] distro: [alma8, ubuntu] python: ["3.9", "3.10", "3.11"] exclude: - - image_dir: alma8 + - distro: alma8 python: 3.9 name: ${{ matrix.image_dir }}-${{ matrix.distro }}-${{ matrix.python }} runs-on: ubuntu-latest @@ -63,10 +63,12 @@ jobs: image_dir: ${{ matrix.image_dir }} python: ${{ matrix.python }} distro: ${{ matrix.distro }} + releasev0: ${{ env.releasev0 }} + release: ${{ env.release }} run: | - image="coffeateam/coffea-${image_dir}-${distro}" + image="coffeateam/${image_dir}-${distro}" - if [ ${image_dir} == 'basev0' ]; then + if [ ${image_dir} == 'coffea-basev0' ]; then tag="${image}:${releasev0}-py${python}" else tag="${image}:${release}-py${python}" @@ -77,13 +79,26 @@ jobs: echo "::set-output name=tag::${tag}" echo "::set-output name=tags::${tags}" - - name: Build + - name: Build base v0 + if: ${{ matrix.image_dir }} == 'coffea-basev0' uses: docker/build-push-action@v5 with: load: true tags: ${{ steps.tags.outputs.tag }} - context: ${{ matrix.image_dir }}/${{ matrix.distro }} - file: ${{ matrix.image_dir }}/${{ matrix.distro }}/Dockerfile + context: ${{ matrix.image_dir }} + file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }} + build-args: | + python=${{ matrix.python }} + release=${{ env.releasev0 }} + + - name: Build base v1 + if: ${{ matrix.image_dir }} != 'coffea-basev0' + uses: docker/build-push-action@v5 + with: + load: true + tags: ${{ steps.tags.outputs.tag }} + context: ${{ matrix.image_dir }} + file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }} build-args: | python=${{ matrix.python }} release=${{ env.release }} @@ -114,14 +129,29 @@ jobs: docker run --rm -v ${{ github.workspace }}:/tmp/workspace ${tag} \ sh -c "pip install -U pytest && cd tmp/workspace && pytest" - - name: Build and push + - name: Build and push v0 + if: ${{ matrix.image_dir }} != 'coffea-basev0' uses: docker/build-push-action@v5 with: - context: ${{ matrix.image_dir }} - file: ${{ matrix.image_dir }}/Dockerfile platforms: linux/amd64 push: ${{ github.event_name == 'push' }} - tags: ${{ steps.tags.outputs.tags }} + tags: ${{ steps.tags.outputs.tag }} + context: ${{ matrix.image_dir }} + file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }} build-args: | python=${{ matrix.python }} release=${{ env.release }} + + - name: Build and push v1 + if: ${{ matrix.image_dir }} == 'coffea-basev0' + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: ${{ github.event_name == 'push' }} + tags: ${{ steps.tags.outputs.tag }} + context: ${{ matrix.image_dir }} + file: ${{ matrix.image_dir }}/Dockerfile.${{ matrix.distro }} + build-args: | + python=${{ matrix.python }} + release=${{ env.releasev0 }} + diff --git a/.github/workflows/watch-conda.yaml b/.github/workflows/watch-conda.yaml index e36b632..40b8d50 100644 --- a/.github/workflows/watch-conda.yaml +++ b/.github/workflows/watch-conda.yaml @@ -11,7 +11,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Get current Coffea version + + - name: Get current Coffea version, both v0 and Calver id: current_version uses: the-coding-turtle/ga-yaml-parser@v0.1.2 with: