diff --git a/.github/actions/compute-matrix/action.yml b/.github/actions/compute-matrix/action.yml new file mode 100644 index 0000000..8749ea1 --- /dev/null +++ b/.github/actions/compute-matrix/action.yml @@ -0,0 +1,30 @@ +name: 'Compute Matrix Action' +description: 'Computes matrix' +outputs: + MATRIX: + description: "Computed matrix" + value: ${{ steps.compute-matrix.outputs.MATRIX }} + LATEST_LINUX_VER: + description: "Latest Linux version" + value: ${{ steps.latest-values.outputs.LATEST_LINUX_VER }} + LATEST_CUDA_VER: + description: "Latest CUDA version" + value: ${{ steps.latest-values.outputs.LATEST_CUDA_VER }} + LATEST_PYTHON_VER: + description: "Latest Python version" + value: ${{ steps.latest-values.outputs.LATEST_PYTHON_VER }} +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Compute latest values + id: latest-values + run: ./ci/compute-latest-versions.sh + shell: bash + - name: Compute matrix + id: compute-matrix + run: | + MATRIX=$(ci/compute-mx.sh) + echo "MATRIX=${MATRIX}" | tee -a ${GITHUB_OUTPUT} + shell: bash diff --git a/.github/workflows/build-and-publish-images.yml b/.github/workflows/build-and-publish-images.yml index a02d349..934a4d2 100644 --- a/.github/workflows/build-and-publish-images.yml +++ b/.github/workflows/build-and-publish-images.yml @@ -16,20 +16,15 @@ jobs: runs-on: ubuntu-latest outputs: MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} - LATEST_LINUX_VER: ${{ steps.latest-values.outputs.LATEST_LINUX_VER }} - LATEST_CUDA_VER: ${{ steps.latest-values.outputs.LATEST_CUDA_VER }} - LATEST_PYTHON_VER: ${{ steps.latest-values.outputs.LATEST_PYTHON_VER }} + LATEST_LINUX_VER: ${{ steps.compute-matrix.outputs.LATEST_LINUX_VER }} + LATEST_CUDA_VER: ${{ steps.compute-matrix.outputs.LATEST_CUDA_VER }} + LATEST_PYTHON_VER: ${{ steps.compute-matrix.outputs.LATEST_PYTHON_VER }} steps: - name: Checkout uses: actions/checkout@v3 - - name: Compute latest values - id: latest-values - run: ./ci/compute-latest-versions.sh - - name: Compute matrix + - name: Compute Matrix id: compute-matrix - run: | - MATRIX=$(ci/compute-mx.sh) - echo "MATRIX=${MATRIX}" | tee -a ${GITHUB_OUTPUT} + uses: ./.github/actions/compute-matrix docker: needs: compute-matrix strategy: @@ -81,24 +76,10 @@ jobs: needs: [compute-matrix, build-multiarch-manifest] strategy: matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }} - runs-on: ubuntu-latest - steps: - - name: Remove temporary images - run: | - HUB_TOKEN=$( - curl -s -H "Content-Type: application/json" \ - -X POST \ - -d "{\"username\": \"${{ secrets.GPUCIBOT_DOCKERHUB_USER }}\", \"password\": \"${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}\"}" \ - https://hub.docker.com/v2/users/login/ | jq -r .token \ - ) - - org="rapidsai" - repo="ci" - tag="cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PYTHON_VER }}" - - for arch in $(echo '${{ toJSON(matrix.ARCHES) }}' | jq .[] -r); do - curl -i -X DELETE \ - -H "Accept: application/json" \ - -H "Authorization: JWT $HUB_TOKEN" \ - "https://hub.docker.com/v2/repositories/$org/$repo/tags/$tag-$arch/" - done + fail-fast: false + uses: ./.github/workflows/delete-temp-images.yml + with: + ARCHES: ${{ toJSON(matrix.ARCHES) }} + CUDA_VER: ${{ matrix.CUDA_VER }} + LINUX_VER: ${{ matrix.LINUX_VER }} + PYTHON_VER: ${{ matrix.PYTHON_VER }} diff --git a/.github/workflows/delete-temp-images.yml b/.github/workflows/delete-temp-images.yml new file mode 100644 index 0000000..0fc8a99 --- /dev/null +++ b/.github/workflows/delete-temp-images.yml @@ -0,0 +1,42 @@ +name: Delete temporary images + +on: + workflow_call: + inputs: + CUDA_VER: + required: true + type: string + LINUX_VER: + required: true + type: string + PYTHON_VER: + required: true + type: string + ARCHES: + required: true + type: string + +jobs: + delete-temp-images: + runs-on: ubuntu-latest + if: always() + steps: + - name: Remove temporary images + run: | + HUB_TOKEN=$( + curl -s -H "Content-Type: application/json" \ + -X POST \ + -d "{\"username\": \"${{ secrets.GPUCIBOT_DOCKERHUB_USER }}\", \"password\": \"${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}\"}" \ + https://hub.docker.com/v2/users/login/ | jq -r .token \ + ) + + org="rapidsai" + repo="ci" + tag="cuda${{ inputs.CUDA_VER }}-${{ inputs.LINUX_VER }}-py${{ inputs.PYTHON_VER }}" + + for arch in $(echo '${{ inputs.ARCHES }}' | jq .[] -r); do + curl -i -X DELETE \ + -H "Accept: application/json" \ + -H "Authorization: JWT $HUB_TOKEN" \ + "https://hub.docker.com/v2/repositories/$org/$repo/tags/$tag-$arch/" + done \ No newline at end of file diff --git a/.github/workflows/pr-closed.yml b/.github/workflows/pr-closed.yml new file mode 100644 index 0000000..2fd0759 --- /dev/null +++ b/.github/workflows/pr-closed.yml @@ -0,0 +1,28 @@ +on: + pull_request: + types: [closed] + +jobs: + compute-matrix: + runs-on: ubuntu-latest + outputs: + MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} + LATEST_LINUX_VER: ${{ steps.compute-matrix.outputs.LATEST_LINUX_VER }} + LATEST_CUDA_VER: ${{ steps.compute-matrix.outputs.LATEST_CUDA_VER }} + LATEST_PYTHON_VER: ${{ steps.compute-matrix.outputs.LATEST_PYTHON_VER }} + steps: + - uses: actions/checkout@v3 + - name: Compute Matrix Action + id: compute-matrix + uses: ./.github/actions/compute-matrix + delete-imgs: + needs: compute-matrix + strategy: + matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }} + uses: ./.github/workflows/delete-temp-images.yml + with: + ARCHES: ${{ toJSON(matrix.ARCHES) }} + CUDA_VER: ${{ matrix.CUDA_VER }} + LINUX_VER: ${{ matrix.LINUX_VER }} + PYTHON_VER: ${{ matrix.PYTHON_VER }} + \ No newline at end of file