[NOMERGE] Debug ccache #4650
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Celerity CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
test-head: | |
description: "Test against 'HEAD' revisions" | |
type: boolean | |
required: true | |
default: false | |
tag-latest: | |
description: "Tag 'HEAD' revisions as 'latest' if successful" | |
type: boolean | |
required: true | |
default: false | |
# We use nightly builds to determine whether CI passes for "HEAD" revisions | |
# of DPC++ and AdaptiveCpp. If so, these revisions are tagged as "latest" and | |
# used for all subsequent CI runs. | |
schedule: | |
# Every night at 05:00 UTC | |
- cron: "0 5 * * *" | |
jobs: | |
find-duplicate-workflows: | |
runs-on: [ self-hosted, slurm ] | |
outputs: | |
should_skip: ${{ steps.skip-check.outputs.should_skip }} | |
steps: | |
- id: skip-check | |
uses: fkirc/[email protected] | |
with: | |
concurrent_skipping: "never" | |
skip_after_successful_duplicate: "false" | |
do_not_skip: '["workflow_dispatch", "schedule"]' | |
cancel_others: "true" | |
# Run Clang-Tidy checks | |
# | |
# Note: This action currently only supports pull_request triggers (as it creates review | |
# comments), so we have to run it regardless of skip-duplicate-action's outcome | |
# (as otherwise pull_request triggers will usually be skipped due to the push | |
# trigger already running). | |
# | |
# TODO: This should be combined with the report (or "lint") step, really | |
clang-tidy: | |
if: github.event.pull_request | |
runs-on: [ self-hosted, slurm-intel ] | |
env: | |
container-workspace: <placeholder> | |
build-dir: /root/build | |
container: | |
image: ghcr.io/celerity/celerity-lint | |
volumes: | |
- ccache:/ccache | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
# Here and in jobs below: We need to manually set the container workspace | |
# path as an environment variable, as (curiously) the `github.workspace` context | |
# variable contains the path on the container host (but $GITHUB_WORKSPACE is correct). | |
- name: Set container workspace environment variable | |
run: echo "container-workspace=$GITHUB_WORKSPACE" > $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch base branch | |
run: git fetch --no-tags --no-recurse-submodules origin "${{ github.event.pull_request.base.ref }}" | |
# We only want to configure CMake, so we build the "help" target, | |
# which doesn't actually do anything (other than print all targets). | |
- name: Configure CMake | |
run: bash -o pipefail -c "bash /root/build-celerity.sh ${{ env.container-workspace }} --build-type Debug --target help" | |
- name: Run clang-tidy | |
continue-on-error: true # clang-tidy-diff.py returns 1 if there are any errors; continue in that case (if something actually went wrong, there won't be a fixes file) | |
# -j48 for gpuc5 | |
run: git diff -U0 origin/${{ github.event.pull_request.base.ref }} | clang-tidy-diff.py -j48 -p1 -path ${{ env.build-dir }} -export-fixes clang-tidy-fixes.yml | |
shell: bash # enables -o pipefail | |
- name: Create clang-tidy report comments | |
uses: platisd/clang-tidy-pr-comments@v1 | |
with: | |
python_path: python3 # Use our own Python installation | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
clang_tidy_fixes: "${{ env.container-workspace }}/clang-tidy-fixes.yml" | |
repo_path_prefix: "/__w" | |
# We need to jump through some hoops to have different build matrices based on what triggered the workflow. | |
# For normal CI runs we want to build and test against everything except the "HEAD" revisions, whereas during | |
# nightly builds we *only* want those. | |
# | |
# Current workaround is to represent the matrix as a JSON object, which is then deserialized in the next job. | |
read-build-matrix: | |
needs: find-duplicate-workflows | |
if: needs.find-duplicate-workflows.outputs.should_skip != 'true' | |
runs-on: self-hosted | |
outputs: | |
matrix: ${{ steps.read-json-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: read-json-matrix | |
name: Read build matrix from file | |
shell: python | |
run: | | |
import json | |
import os | |
with open("${{ github.workspace }}/.github/workflows/build_matrix.json") as f: | |
matrices = json.load(f) | |
if '${{ github.event_name != 'schedule' && inputs.test-head == false }}' == 'true': | |
matrix = matrices['default'] | |
else: | |
matrix = matrices['nightly'] | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | |
print('matrix={ "include":%s }' % json.dumps(matrix), file=fh) | |
build-and-test: | |
needs: [find-duplicate-workflows, read-build-matrix] | |
if: ${{ needs.find-duplicate-workflows.outputs.should_skip != 'true' }} | |
runs-on: [ self-hosted, "slurm-${{ matrix.platform }}" ] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.read-build-matrix.outputs.matrix) }} | |
# These outputs are required by the image tagging step, only set during nightly builds. | |
outputs: | |
dpcpp-HEAD-Debug-works: ${{ steps.set-head-results.outputs.dpcpp-HEAD-Debug-works }} | |
dpcpp-HEAD-Release-works: ${{ steps.set-head-results.outputs.dpcpp-HEAD-Release-works }} | |
dpcpp-HEAD-ubuntu-version: ${{ steps.set-head-results.outputs.dpcpp-HEAD-ubuntu-version }} | |
acpp-HEAD-Debug-works: ${{ steps.set-head-results.outputs.acpp-HEAD-Debug-works }} | |
acpp-HEAD-Release-works: ${{ steps.set-head-results.outputs.acpp-HEAD-Release-works }} | |
acpp-HEAD-ubuntu-version: ${{ steps.set-head-results.outputs.acpp-HEAD-ubuntu-version }} | |
env: | |
build-name: ${{ matrix.platform }}-ubuntu${{ matrix.ubuntu-version }}-${{ matrix.sycl }}-${{ matrix.sycl-version }}-${{ matrix.build-type }} | |
container-workspace: <placeholder> | |
build-dir: /root/build | |
examples-build-dir: /root/build-examples | |
container: | |
image: ghcr.io/celerity/celerity-build/${{ matrix.sycl }}:ubuntu${{ matrix.ubuntu-version }}-${{ matrix.sycl-version }} | |
volumes: | |
- ccache:/ccache | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
# We limit DPC++ to Level-Zero devices (instead of e.g. also showing OpenCL or CUDA devices). | |
# Most importantly, despite its naming, this currently also avoids the "Unified Runtime over Level-Zero", which | |
# doesn't seem to be quite ready for production use yet (= it crashes). | |
- name: Set environment variables | |
run: | | |
echo "container-workspace=$GITHUB_WORKSPACE" > $GITHUB_ENV | |
echo "ONEAPI_DEVICE_SELECTOR=level_zero:*" >> $GITHUB_ENV | |
echo "SIMSYCL_SYSTEM=$GITHUB_WORKSPACE/ci/simsycl-system.json" >> $GITHUB_ENV | |
- name: Print exact SYCL revision used for this CI run | |
run: cat /VERSION | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Does the glob work? | |
run: find ${{ env.container-workspace }}/.github -type f | xargs -I{} bash -c "echo file {}" | |
# In SimSYCL images, /root/celerity-options.sh automatically enables coverage for Debug builds, and Tracy support for Release builds | |
- name: Build and install Celerity | |
run: bash -o pipefail -c "export CCACHE_DEBUG=1; export CCACHE_DEBUGDIR=\"${{ env.container-workspace }}/ccache\"; export CCACHE_DEPEND=1; bash /root/build-celerity.sh ${{ env.container-workspace }} --build-type ${{ matrix.build-type }} --mpi ${{ matrix.mpi }} --target install 2>&1 | tee ${{ env.build-name }}.log" | |
# Upload build log for report step | |
- name: Print ccache debug logs | |
run: find ${{ env.container-workspace }}/ccache -type f | xargs -I{} bash -c "echo \"ccache log file {}:\"; cat {}" | |
# Tag "HEAD" images that built and tested successfully as "latest". | |
# This is only done for nightly builds (or when specifying the "tag-latest" option on manually triggered runs). | |
tag-latest-containers: | |
needs: [find-duplicate-workflows, build-and-test] | |
# Run this step regardless of result of `build-and-test` (hence the `always()`), | |
# since we always want to tag images that were successful, even if others weren't. | |
if: always() && needs.find-duplicate-workflows.outputs.should_skip != 'true' && (github.event_name == 'schedule' || (inputs.test-head && inputs.tag-latest)) | |
runs-on: slurm-${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- sycl: "dpcpp" | |
platform: "intel" | |
- sycl: "acpp" | |
platform: "nvidia" | |
env: | |
image-basename-dpcpp: ghcr.io/celerity/celerity-build/dpcpp:ubuntu${{ needs.build-and-test.outputs.dpcpp-HEAD-ubuntu-version }} | |
image-basename-acpp: ghcr.io/celerity/celerity-build/acpp:ubuntu${{ needs.build-and-test.outputs.acpp-HEAD-ubuntu-version }} | |
permissions: | |
packages: write | |
steps: | |
- name: Log into Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- if: matrix.sycl == 'dpcpp' | |
run: | | |
if [[ "${{ needs.build-and-test.outputs.dpcpp-HEAD-Debug-works }}" -eq 1 ]] && [[ "${{ needs.build-and-test.outputs.dpcpp-HEAD-Release-works }}" -eq 1 ]]; then | |
docker tag ${{ env.image-basename-dpcpp }}-HEAD ${{ env.image-basename-dpcpp }}-latest | |
docker push ${{ env.image-basename-dpcpp }}-latest | |
else | |
exit 1 | |
fi | |
- if: matrix.sycl == 'acpp' | |
run: | | |
if [[ "${{ needs.build-and-test.outputs.acpp-HEAD-Debug-works }}" -eq 1 ]] && [[ "${{ needs.build-and-test.outputs.acpp-HEAD-Release-works }}" -eq 1 ]]; then | |
docker tag ${{ env.image-basename-acpp }}-HEAD ${{ env.image-basename-acpp }}-latest | |
docker push ${{ env.image-basename-acpp }}-latest | |
else | |
exit 1 | |
fi | |
report: | |
needs: [find-duplicate-workflows, build-and-test] | |
if: ${{ needs.find-duplicate-workflows.outputs.should_skip != 'true' }} | |
runs-on: [ self-hosted, slurm ] | |
env: | |
container-workspace: <placeholder> | |
container: | |
image: ghcr.io/celerity/celerity-lint | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Set container workspace environment variable | |
run: echo "container-workspace=$GITHUB_WORKSPACE" > $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Check code formatting | |
id: formatting | |
working-directory: ${{ env.container-workspace }} | |
shell: bash | |
run: | | |
unformatted=$("./ci/find-unformatted-files.sh") | |
{ | |
echo 'unformatted-files<<EOF' | |
echo "$unformatted" | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
- uses: "celerity/ci-report-action@v7" | |
with: | |
gh-token: ${{ secrets.GITHUB_TOKEN }} | |
unformatted-files: ${{ steps.formatting.outputs.unformatted-files }} |