Skip to content

Commit

Permalink
[DRAFT] CI experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
alliepiper committed Apr 22, 2024
1 parent 29a24f4 commit b24cc14
Show file tree
Hide file tree
Showing 11 changed files with 1,119 additions and 345 deletions.
25 changes: 0 additions & 25 deletions .github/actions/compute-matrix/action.yml

This file was deleted.

82 changes: 0 additions & 82 deletions .github/actions/compute-matrix/compute-matrix.sh

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/ci-dispatch-group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "CI/Dispatch/Group"

defaults:
run:
shell: bash -euo pipefail {0}

on:
workflow_call:
inputs:
name: {type: string, required: true}
jobs: {type: string, required: true}

permissions:
contents: read

jobs:
standlone-jobs:
if: fromJSON(inputs.jobs)['standalone']
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(inputs.jobs)['standalone']}}
uses: ./.github/workflows/ci-dispatch-job.yml
with:
dispatch: ${{ matrix.dispatch }}
name: ${{ matrix.name }}
runner: ${{ matrix.runner }}
image: ${{ matrix.image }}
command: ${{ matrix.command }}

two-stage-jobs:
if: fromJSON(inputs.jobs)['two_stage']
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(inputs.jobs)['two_stage']}}
uses: ./.github/workflows/ci-dispatch-two-stage.yml
with:
producers: ${{ toJSON(matrix.producers) }}
consumers: ${{ toJSON(matrix.consumers) }}
118 changes: 118 additions & 0 deletions .github/workflows/ci-dispatch-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: "CI/Dispatch/Job"

defaults:
run:
shell: bash

on:
workflow_call:
inputs:
dispatch: {type: string, required: true}
name: {type: string, required: true}
image: {type: string, required: true}
runner: {type: string, required: true}
command: {type: string, required: true}
env: {type: string, required: false}
dummy_matrix: {type: string, required: false, default: '{"valid": true}'}

permissions:
contents: read

jobs:
linux:
name: ${{inputs.name}}
if: startsWith(inputs.dispatch, 'linux')
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{ startsWith(inputs.dispatch, 'linux') && fromJSON(inputs.dummy_matrix) }}
runs-on: ${{inputs.runner}}
container:
options: -u root
image: ${{inputs.image}}
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
path: cccl
persist-credentials: false
- name: Move files to coder user home directory
run: |
cp -R cccl /home/coder/cccl
chown -R coder:coder /home/coder/
- name: Add NVCC problem matcher
run: |
echo "::add-matcher::cccl/.github/problem-matchers/problem-matcher.json"
- name: Configure credentials and environment variables for sccache
uses: ./cccl/.github/actions/configure_cccl_sccache
- name: Run command
shell: su coder {0}
run: |
set -eo pipefail
cd ~/cccl
echo -e "\e[1;34mRunning as 'coder' user in $(pwd):\e[0m"
echo -e "\e[1;34m${{inputs.command}}\e[0m"
eval "${{inputs.command}}" || exit_code=$?
if [ ! -z "$exit_code" ]; then
echo -e "::group::️❗ \e[1;31mInstructions to Reproduce CI Failure Locally\e[0m"
echo "::error:: To replicate this failure locally, follow the steps below:"
echo "1. Clone the repository, and navigate to the correct branch and commit:"
echo " git clone --branch $GITHUB_REF_NAME --single-branch https://github.com/$GITHUB_REPOSITORY.git && cd $(echo $GITHUB_REPOSITORY | cut -d'/' -f2) && git checkout $GITHUB_SHA"
echo ""
echo "2. Run the failed command inside the same Docker container used by the CI:"
echo " docker run --rm -it --gpus all --pull=always --volume \$PWD:/repo --workdir /repo ${{ inputs.image }} ${{inputs.command}}"
echo ""
echo "For additional information, see:"
echo " - DevContainer Documentation: https://github.com/NVIDIA/cccl/blob/main/.devcontainer/README.md"
echo " - Continuous Integration (CI) Overview: https://github.com/NVIDIA/cccl/blob/main/ci-overview.md"
exit $exit_code
fi
windows:
name: ${{inputs.name}}
if: startsWith(inputs.dispatch, 'windows')
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{ startsWith(inputs.dispatch, 'windows') && fromJSON(inputs.dummy_matrix) }}
runs-on: ${{inputs.runner}}
env:
SCCACHE_BUCKET: rapids-sccache-devs
SCCACHE_REGION: us-east-2
SCCACHE_IDLE_TIMEOUT: 0
SCCACHE_S3_USE_SSL: true
SCCACHE_S3_NO_CREDENTIALS: false
steps:
- name: Get AWS credentials for sccache bucket
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
aws-region: us-east-2
role-duration-seconds: 43200 # 12 hours
- name: Fetch ${{ inputs.image }}
shell: powershell
run: docker pull ${{ inputs.image }}
- name: Run Command
shell: powershell
run: >-
docker run ${{ inputs.image }} powershell -c "[System.Environment]::SetEnvironmentVariable('AWS_ACCESS_KEY_ID','${{env.AWS_ACCESS_KEY_ID}}')
[System.Environment]::SetEnvironmentVariable('AWS_SECRET_ACCESS_KEY','${{env.AWS_SECRET_ACCESS_KEY}}')
[System.Environment]::SetEnvironmentVariable('AWS_SESSION_TOKEN','${{env.AWS_SESSION_TOKEN }}')
[System.Environment]::SetEnvironmentVariable('SCCACHE_BUCKET','${{env.SCCACHE_BUCKET}}')
[System.Environment]::SetEnvironmentVariable('SCCACHE_REGION','${{env.SCCACHE_REGION}}')
[System.Environment]::SetEnvironmentVariable('SCCACHE_IDLE_TIMEOUT','${{env.SCCACHE_IDLE_TIMEOUT}}')
[System.Environment]::SetEnvironmentVariable('SCCACHE_S3_USE_SSL','${{env.SCCACHE_S3_USE_SSL}}')
[System.Environment]::SetEnvironmentVariable('SCCACHE_S3_NO_CREDENTIALS','${{env.SCCACHE_S3_NO_CREDENTIALS}}')
git clone https://github.com/NVIDIA/cccl.git;
cd cccl;
git fetch --all;
git checkout ${{github.ref_name}};
${{inputs.command}}"
52 changes: 52 additions & 0 deletions .github/workflows/ci-dispatch-two-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "CI/Dispatch/TwoStage"

defaults:
run:
shell: bash -euo pipefail {0}

on:
workflow_call:
inputs:
producers: {type: string, required: true}
consumers: {type: string, required: true}

permissions:
contents: read

jobs:
producers:
name: ${{ matrix.name }}
if: fromJSON(inputs.producers)
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(inputs.producers)}}
uses: ./.github/workflows/ci-dispatch-job.yml
with:
dispatch: ${{ matrix.dispatch }}
name: ${{ matrix.name }}
runner: ${{ matrix.runner }}
image: ${{ matrix.image }}
command: ${{ matrix.command }}

consumers:
name: ${{ matrix.name }}
if: fromJSON(inputs.consumers)
needs: producers
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(inputs.consumers)}}
uses: ./.github/workflows/ci-dispatch-job.yml
with:
dispatch: ${{ matrix.dispatch }}
name: ${{ matrix.name }}
runner: ${{ matrix.runner }}
image: ${{ matrix.image }}
command: ${{ matrix.command }}
1 change: 1 addition & 0 deletions .github/workflows/dispatch-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflow_call:
inputs:
project_name: {type: string, required: true}
job_type: {type: string, required: true}
per_cuda_compiler_matrix: {type: string, required: true}
devcontainer_version: {type: string, required: true}
is_windows: {type: boolean, required: true}
Expand Down
Loading

0 comments on commit b24cc14

Please sign in to comment.