Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Overhaul, new nightly workflow #1654

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .devcontainer/make_devcontainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ while [[ $# -gt 0 ]]; do
done

MATRIX_FILE="../ci/matrix.yaml"
COMPUTE_MATRIX="../.github/actions/workflow-build/build-workflow.py"

# Enable verbose mode if requested
if [ "$VERBOSE" = true ]; then
Expand All @@ -82,16 +83,17 @@ if [ "$VERBOSE" = true ]; then
fi

# Read matrix.yaml and convert it to json
matrix_json=$(yq -o json ${MATRIX_FILE})
matrix_json=$(python3 ${COMPUTE_MATRIX} ${MATRIX_FILE} --devcontainer-info)

# Exclude Windows environments
readonly matrix_json=$(echo "$matrix_json" | jq 'del(.pull_request.nvcc[] | select(.os | contains("windows")))')
if [ "$VERBOSE" = true ]; then
echo "$matrix_json"
fi

# Get the devcontainer image version and define image tag root
readonly DEVCONTAINER_VERSION=$(echo "$matrix_json" | jq -r '.devcontainer_version')

# Get unique combinations of cuda version, compiler name/version, and Ubuntu version
readonly combinations=$(echo "$matrix_json" | jq -c '[.pull_request.nvcc[] | {cuda: .cuda, compiler_name: .compiler.name, compiler_exe: .compiler.exe, compiler_version: .compiler.version, os: .os}] | unique | .[]')
readonly combinations=$(echo "$matrix_json" | jq -c '.combinations[]')

# Update the base devcontainer with the default values
# The root devcontainer.json file is used as the default container as well as a template for all
Expand Down
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.

95 changes: 95 additions & 0 deletions .github/actions/workflow-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: "CCCL Build Workflow"
description: "Parses a matrix definition and exports a set of dispatchable build/test/etc jobs."

inputs:
workflows:
description: "Space separated list of workflows in matrix file to run"
required: true
skip_tests:
description: "Skip running tests"
default: "false"
required: false
inspect_changes_script:
description: "If defined, run this script to determine which projects/deps need to be tested."
default: ""
required: false
inspect_changes_base_sha:
description: "If defined, use this base ref for inspect-changes script."
default: ""
required: false
matrix_file:
description: "Path to the matrix file in the consumer repository."
default: "ci/matrix.yaml"
required: false
matrix_parser:
description: "Path to the matrix parser script (default if blank: build-workflow.py from action dir)"
default: ""
required: false

outputs:
workflow:
description: "The dispatchable workflow matrix"
value: ${{ steps.build-workflow.outputs.workflow }}
workflow_keys:
description: "The keys of the parsed workflow"
value: ${{ steps.build-workflow.outputs.workflow_keys }}

runs:
using: "composite"
steps:

- name: Inspect changes
if: ${{ inputs.inspect_changes_script != '' && inputs.inspect_changes_base_sha != '' }}
id: inspect-changes
shell: bash --noprofile --norc -euo pipefail {0}
env:
base_ref: ${{ inputs.inspect_changes_base_sha }}
run: |
echo "Running inspect-changes script..."
${{ inputs.inspect_changes_script }} ${base_ref} ${GITHUB_SHA}
echo "Exporting summary..."
mkdir workflow
cp ${GITHUB_STEP_SUMMARY} workflow/changes.md

- name: Parse matrix file into a workflow
id: build-workflow
shell: bash --noprofile --norc -euo pipefail {0}
env:
skip_tests: ${{ inputs.skip_tests == 'true' && '--skip-tests' || ''}}
dirty_projects_flag: ${{ steps.inspect-changes.outputs.dirty_projects != '' && '--dirty-projects' || ''}}
dirty_projects: ${{ steps.inspect-changes.outputs.dirty_projects }}
matrix_parser: ${{ inputs.matrix_parser && inputs.matrix_parser || '${GITHUB_ACTION_PATH}/build-workflow.py' }}
run: |
echo "Parsing matrix file into a workflow..."

${{ env.matrix_parser }} ${{ inputs.matrix_file }} \
--workflows ${{ inputs.workflows }} \
${{ env.skip_tests }} \
${{ env.dirty_projects_flag }} ${{ env.dirty_projects }}

echo "::group::Workflow"
cat workflow/workflow.json
echo "::endgroup::"

echo "::group::Runners"
cat workflow/runner_summary.json | jq -r '"# \(.heading)\n\n\(.body)"' | tee -a "${GITHUB_STEP_SUMMARY}"
echo "::endgroup::"

echo "::group::Job List"
cat workflow/job_list.txt
echo "::endgroup::"

echo "Setting outputs..."
echo "::group::GHA Output: WORKFLOW"
printf "WORKFLOW=%s\n" "$(cat workflow/workflow.json | jq -c '.')" | tee -a "${GITHUB_OUTPUT}"
echo "::endgroup::"

echo "::group::GHA Output: WORKFLOW_KEYS"
printf "WORKFLOW_KEYS=%s\n" "$(cat workflow/workflow_keys.json | jq -c '.')" | tee -a "${GITHUB_OUTPUT}"
echo "::endgroup::"

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: workflow
path: workflow/
Loading
Loading