Skip to content

Commit

Permalink
CI: Move the clang-plugins-enabled build to a separate job
Browse files Browse the repository at this point in the history
The plugins build that runs on master currently uses the same ccache key
as non-plugin builds in PRs. This means all clang PR builds are not able
to use ccache.

Move the plugins build to a separate job. This job also has sanitizers
disabled to make the plugins build quicker.
  • Loading branch information
trflynn89 committed Aug 27, 2024
1 parent f52bb43 commit 730ec6a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 21 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/clang-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Validate code with clang plugins

# FIXME: The plugins seem to make this build uncacheable by ccache. We should figure that out and enable this job on PRs.
# Perhaps with https://ccache.dev/manual/latest.html#config_compiler_check, which mentions plugins.
on: [push]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
build-and-verify:
if: always() && github.repository == 'LadybirdBrowser/ladybird' && github.ref == 'refs/heads/master'

uses: ./.github/workflows/lagom-template.yml
with:
toolchain: 'Clang'
os_name: 'Linux'
os: 'ubuntu-22.04'
clang_plugins: true
51 changes: 30 additions & 21 deletions .github/workflows/lagom-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
required: false
type: string
default: 'NO_FUZZ'
clang_plugins:
required: false
type: boolean
default: false

env:
# runner.workspace = /home/runner/work/serenity
Expand Down Expand Up @@ -49,40 +53,45 @@ jobs:

# === PREPARE FOR BUILDING ===

- name: Restore Caches
uses: ./.github/actions/cache-restore
id: 'cache-restore'
with:
os: ${{ inputs.os_name }}
arch: 'Lagom'
toolchain: ${{ inputs.toolchain }}
cache_key_extra: ${{ inputs.fuzzer }}
serenity_ccache_path: ${{ env.CCACHE_DIR }}
download_cache_path: ${{ github.workspace }}/Build/caches

- name: Assign Build Parameters
id: 'build-parameters'
run: |
if ${{ inputs.os_name == 'Linux' }} ; then
if ${{ inputs.toolchain == 'Clang' }} ; then
echo "host_cc=clang-18" >> "$GITHUB_OUTPUT"
echo "host_cxx=clang++-18" >> "$GITHUB_OUTPUT"
if ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} ; then
echo "extra_cmake_options=-DENABLE_CLANG_PLUGINS=ON" >> "$GITHUB_OUTPUT"
else
echo "extra_cmake_options=" >> "$GITHUB_OUTPUT"
fi
elif ${{ inputs.toolchain == 'GNU' }} ; then
echo "host_cc=gcc-13" >> "$GITHUB_OUTPUT"
echo "host_cxx=g++-13" >> "$GITHUB_OUTPUT"
echo "extra_cmake_options=" >> "$GITHUB_OUTPUT"
fi
elif ${{ inputs.os_name == 'macOS' }} ; then
echo "host_cc=$(xcrun --find clang)" >> "$GITHUB_OUTPUT"
echo "host_cxx=$(xcrun --find clang++)" >> "$GITHUB_OUTPUT"
echo "extra_cmake_options=" >> "$GITHUB_OUTPUT"
fi
if ${{ inputs.clang_plugins }} ; then
echo "ccache_key=${{ inputs.fuzzer }}-CLANG_PLUGINS" >> "$GITHUB_OUTPUT"
echo "cmake_build_preset=CI" >> "$GITHUB_OUTPUT"
echo "cmake_test_preset=default" >> "$GITHUB_OUTPUT"
echo "cmake_options=-DENABLE_CLANG_PLUGINS=ON" >> "$GITHUB_OUTPUT"
else
echo "ccache_key=${{ inputs.fuzzer }}" >> "$GITHUB_OUTPUT"
echo "cmake_build_preset=Sanitizer_CI" >> "$GITHUB_OUTPUT"
echo "cmake_test_preset=Sanitizer" >> "$GITHUB_OUTPUT"
echo "cmake_options=" >> "$GITHUB_OUTPUT"
fi
- name: Restore Caches
uses: ./.github/actions/cache-restore
id: 'cache-restore'
with:
os: ${{ inputs.os_name }}
arch: 'Lagom'
toolchain: ${{ inputs.toolchain }}
cache_key_extra: ${{ steps.build-parameters.outputs.ccache_key }}
serenity_ccache_path: ${{ env.CCACHE_DIR }}
download_cache_path: ${{ github.workspace }}/Build/caches

- name: Set dynamic environment variables
id: 'set-env-vars'
run: |
Expand All @@ -99,10 +108,10 @@ jobs:
if: ${{ inputs.fuzzer == 'NO_FUZZ' }}
working-directory: ${{ github.workspace }}
run: |
cmake --preset Sanitizer_CI -B Build \
cmake --preset ${{ steps.build-parameters.outputs.cmake_build_preset }} -B Build \
-DINCLUDE_WASM_SPEC_TESTS=ON \
-DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
${{ steps.build-parameters.outputs.extra_cmake_options }} \
${{ steps.build-parameters.outputs.cmake_options }} \
-DCMAKE_C_COMPILER=${{ steps.build-parameters.outputs.host_cc }} \
-DCMAKE_CXX_COMPILER=${{ steps.build-parameters.outputs.host_cxx }}
Expand Down Expand Up @@ -169,7 +178,7 @@ jobs:
- name: Test
if: ${{ inputs.fuzzer == 'NO_FUZZ' }}
working-directory: ${{ github.workspace }}
run: ctest --preset Sanitizer --output-on-failure --test-dir Build
run: ctest --preset ${{ steps.build-parameters.outputs.cmake_test_preset }} --output-on-failure --test-dir Build
env:
TESTS_ONLY: 1

Expand Down

0 comments on commit 730ec6a

Please sign in to comment.