From 27f0e7946906ac48a55d02cfbf88ca80f2a29b17 Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Wed, 19 Jul 2023 15:23:44 +0000 Subject: [PATCH] Add post processing to set nvcc-specific matrix outputs. --- .github/workflows/pr.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7243761713..bc9b1e0e3b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,7 +4,7 @@ name: pr defaults: run: - shell: bash + shell: bash -euo pipefail {0} on: push: @@ -21,14 +21,29 @@ jobs: compute-nvcc-matrix: name: Compute NVCC matrix runs-on: ubuntu-latest + outputs: + CUDA_VERSIONS: ${{ steps.set-outputs.outputs.CUDA_VERSIONS }} + HOST_COMPILERS: ${{ steps.set-outputs.outputs.HOST_COMPILERS }} + PER_CUDA_COMPILER_MATRIX: ${{ steps.set-outputs.outputs.PER_CUDA_COMPILER_MATRIX }} steps: - name: Checkout repo uses: actions/checkout@v3 - name: Get full nvcc matrix + id: compute-nvcc-matrix uses: ./.github/actions/compute-matrix with: matrix_file: './ci/matrix.yaml' matrix_query: '.pull_request.nvcc' + - name: Set outputs + id: set-outputs + run: | + FULL_MATRIX=${{steps.compute-nvcc-matrix.outputs.matrix}} + CUDA_VERSIONS=$(echo $FULL_MATRIX | jq -c '[.[] | .cuda] | unique') + echo "CUDA_VERSIONS=$CUDA_VERSIONS" | tee -a "$GITHUB_OUTPUT" + HOST_COMPILERS=$(echo $FULL_MATRIX | jq -c '[.[] | .compiler.name] | unique') + echo "HOST_COMPILERS=$HOST_COMPILERS" | tee -a "$GITHUB_OUTPUT" + PER_CUDA_COMPILER_MATRIX=$(echo $FULL_MATRIX | jq -c ' group_by(.cuda + .compiler.name) | map({(.[0].cuda + "-" + .[0].compiler.name): .}) | add') + echo "PER_CUDA_COMPILER_MATRIX=$PER_CUDA_COMPILER_MATRIX" | tee -a "$GITHUB_OUTPUT" thrust: name: Thrust CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} @@ -38,7 +53,7 @@ jobs: fail-fast: false matrix: cuda_version: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.CUDA_VERSIONS) }} - compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.COMPILERS) }} + compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.HOST_COMPILERS) }} with: per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-nvcc-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} build_script: "./ci/build_thrust.sh" @@ -52,7 +67,7 @@ jobs: fail-fast: false matrix: cuda_version: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.CUDA_VERSIONS) }} - compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.COMPILERS) }} + compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.HOST_COMPILERS) }} with: per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-nvcc-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} build_script: "./ci/build_cub.sh" @@ -66,7 +81,7 @@ jobs: fail-fast: false matrix: cuda_version: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.CUDA_VERSIONS) }} - compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.COMPILERS) }} + compiler: ${{ fromJSON(needs.compute-nvcc-matrix.outputs.HOST_COMPILERS) }} with: per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-nvcc-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ format('{0}-{1}', matrix.cuda_version, matrix.compiler) ]) }} build_script: "./ci/build_libcudacxx.sh"