diff --git a/.github/workflows/build-and-test-linux.yml b/.github/workflows/build-and-test-linux.yml index b328e97884a..32cfc259514 100644 --- a/.github/workflows/build-and-test-linux.yml +++ b/.github/workflows/build-and-test-linux.yml @@ -14,9 +14,15 @@ on: container_image: {type: string, required: false} run_tests: {type: boolean, required: false, default: true} +permissions: + contents: read + jobs: build: name: Build ${{inputs.test_name}} + permissions: + id-token: write + contents: read uses: ./.github/workflows/run-as-coder.yml with: name: Build ${{inputs.test_name}} @@ -27,6 +33,9 @@ jobs: test: needs: build + permissions: + id-token: write + contents: read if: ${{ !cancelled() && ( needs.build.result == 'success' || needs.build.result == 'skipped' ) && inputs.run_tests}} name: Test ${{inputs.test_name}} uses: ./.github/workflows/run-as-coder.yml diff --git a/.github/workflows/dispatch-build-and-test.yml b/.github/workflows/dispatch-build-and-test.yml index 553ae40db25..b3052d38e9d 100644 --- a/.github/workflows/dispatch-build-and-test.yml +++ b/.github/workflows/dispatch-build-and-test.yml @@ -8,12 +8,18 @@ on: devcontainer_version: {type: string, required: true} is_windows: {type: boolean, required: true} +permissions: + contents: read + jobs: # Using a matrix to dispatch to the build-and-test reusable workflow for each build configuration # ensures that the build/test steps can overlap across different configurations. For example, # the build step for CUDA 12.1 + gcc 9.3 can run at the same time as the test step for CUDA 11.0 + clang 11. build_and_test_linux: name: build and test linux + permissions: + id-token: write + contents: read if: ${{ !inputs.is_windows }} uses: ./.github/workflows/build-and-test-linux.yml strategy: @@ -30,6 +36,9 @@ jobs: build_and_test_windows: name: build and test windows + permissions: + id-token: write + contents: read if: ${{ inputs.is_windows }} uses: ./.github/workflows/build-and-test-windows.yml strategy: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c56e2e1f6f3..28da0d5df4f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -30,6 +30,10 @@ concurrency: group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }} cancel-in-progress: true +permissions: + contents: read + pull-requests: read + jobs: compute-matrix: name: Compute matrix @@ -53,6 +57,9 @@ jobs: nvrtc: name: NVRTC CUDA${{matrix.cuda}} C++${{matrix.std}} + permissions: + id-token: write + contents: read needs: compute-matrix if: ${{ !contains(github.event.head_commit.message, 'skip-tests') }} uses: ./.github/workflows/run-as-coder.yml @@ -69,6 +76,9 @@ jobs: thrust: name: Thrust CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + permissions: + id-token: write + contents: read needs: compute-matrix uses: ./.github/workflows/dispatch-build-and-test.yml strategy: @@ -84,6 +94,9 @@ jobs: cub: name: CUB CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + permissions: + id-token: write + contents: read needs: compute-matrix uses: ./.github/workflows/dispatch-build-and-test.yml strategy: @@ -99,6 +112,9 @@ jobs: libcudacxx: name: libcudacxx CUDA${{ matrix.cuda_version }} ${{ matrix.compiler }} + permissions: + id-token: write + contents: read needs: compute-matrix uses: ./.github/workflows/dispatch-build-and-test.yml strategy: @@ -114,6 +130,9 @@ jobs: clang-cuda: name: ${{matrix.lib}} ${{matrix.cpu}}/CTK${{matrix.cuda}}/clang-cuda + permissions: + id-token: write + contents: read needs: compute-matrix strategy: fail-fast: false @@ -129,6 +148,9 @@ jobs: cccl-infra: name: CCCL Infrastructure + permissions: + id-token: write + contents: read needs: compute-matrix if: ${{ !contains(github.event.head_commit.message, 'skip-tests') }} strategy: @@ -146,6 +168,9 @@ jobs: verify-devcontainers: name: Verify Dev Containers + permissions: + id-token: write + contents: read uses: ./.github/workflows/verify-devcontainers.yml # This job is the final job that runs after all other jobs and is used for branch protection status checks. @@ -154,7 +179,7 @@ jobs: ci: runs-on: ubuntu-latest name: CI - if: ${{ always() }} # need to use always() instead of !cancelled() because skipped jobs count as success + if: ${{ always() }} # need to use always() instead of !cancelled() because skipped jobs count as success needs: - clang-cuda - cub diff --git a/.github/workflows/run-as-coder.yml b/.github/workflows/run-as-coder.yml index 8d0cce9fba6..6d09fd220ff 100644 --- a/.github/workflows/run-as-coder.yml +++ b/.github/workflows/run-as-coder.yml @@ -14,17 +14,21 @@ on: command: {type: string, required: true} env: { type: string, required: false, default: "" } +permissions: + contents: read + jobs: run-as-coder: name: ${{inputs.name}} + permissions: + id-token: write + contents: read runs-on: ${{inputs.runner}} container: options: -u root image: ${{inputs.image}} env: NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} - permissions: - id-token: write steps: - name: Checkout repo uses: actions/checkout@v3 diff --git a/.github/workflows/verify-devcontainers.yml b/.github/workflows/verify-devcontainers.yml index baa6c2e2739..ef9780f820f 100644 --- a/.github/workflows/verify-devcontainers.yml +++ b/.github/workflows/verify-devcontainers.yml @@ -7,6 +7,9 @@ defaults: run: shell: bash -euo pipefail {0} +permissions: + contents: read + jobs: verify-make-devcontainers: name: Verify devcontainer files are up-to-date