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

[WIP] CI: handle required workflows when skipped #5469

Open
wants to merge 51 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7f59e52
Add docs change to trigger CI
EZoni Nov 18, 2024
0432f0a
Add workflow to check files changed
EZoni Nov 18, 2024
20250bb
Debugging
EZoni Nov 18, 2024
bfda461
Debugging: skip macOS workflow
EZoni Nov 18, 2024
360b43d
Debugging: skip Azure workflows
EZoni Nov 18, 2024
ff66cf8
Debugging
EZoni Nov 18, 2024
6f7023f
Debugging: try reusable workflows
EZoni Nov 18, 2024
b7a8ffb
Debugging: use separate bash script
EZoni Nov 19, 2024
f8d5036
Debugging
EZoni Nov 19, 2024
a443348
Debugging from scratch
EZoni Nov 19, 2024
8020529
Debugging
EZoni Nov 19, 2024
07f752f
Clean up bash script
EZoni Nov 19, 2024
616e07c
Clean up bash script
EZoni Nov 19, 2024
33520ed
Clean up bash script
EZoni Nov 19, 2024
822c719
Use shared YAML file
EZoni Nov 19, 2024
f456176
Fix shared YAML file
EZoni Nov 19, 2024
4f79b76
Debugging shared YAML file
EZoni Nov 19, 2024
6d01072
Clean up workflow files
EZoni Nov 19, 2024
8cdcfc9
Clean up workflow files
EZoni Nov 19, 2024
b1dacec
Clean up workflow files
EZoni Nov 19, 2024
8628ce1
Clean up workflow files
EZoni Nov 19, 2024
69b8902
Clean up workflow files
EZoni Nov 19, 2024
f7bb79e
Pass `runs-on` as input
EZoni Nov 19, 2024
4754962
Add missing `type` parameter
EZoni Nov 19, 2024
b185fcc
Update ubuntu workflow
EZoni Nov 19, 2024
3394214
Update clang sanitizers workflow
EZoni Nov 19, 2024
96e5527
Fix clang sanitizers workflow
EZoni Nov 19, 2024
bdf2fe0
Update clang tidy workflow
EZoni Nov 19, 2024
ea76676
Update code quality workflow
EZoni Nov 19, 2024
6a6c48c
Update cuda workflow
EZoni Nov 19, 2024
2a264cf
Update hip workflow
EZoni Nov 19, 2024
698cbfd
Update insitu workflow
EZoni Nov 19, 2024
b9e03e0
Update intel workflow
EZoni Nov 19, 2024
af29335
Update windows workflow
EZoni Nov 19, 2024
f523373
Fix windows workflow
EZoni Nov 19, 2024
eb21f6a
Try skipping full job in macOS workflow
EZoni Nov 19, 2024
5c46e8d
Skip full jobs in all workflows
EZoni Nov 19, 2024
488add9
Skip each clang tidy matrix workflow
EZoni Nov 19, 2024
90a2751
Revert changes done only for testing
EZoni Nov 19, 2024
c4681e1
Fix `if` condition
EZoni Nov 19, 2024
3ddb412
Test `if` condition
EZoni Nov 19, 2024
7dcd716
Debug `if` condition
EZoni Nov 19, 2024
eb2cb20
Do not use shared YAML file
EZoni Nov 19, 2024
cfbcd0b
Try setting `SKIP_CHECKS` to string
EZoni Nov 19, 2024
a7dce8e
Output from separate workflow file does not work
EZoni Nov 19, 2024
4094c1f
Test new fix
EZoni Nov 19, 2024
5119f4c
Fix all workflows
EZoni Nov 19, 2024
44b99c0
Remove obsolete file
EZoni Nov 19, 2024
4dbe458
Fix clang tidy workflow
EZoni Nov 19, 2024
6636191
Clean up
EZoni Nov 19, 2024
7a5e040
Reset paths to ignore
EZoni Nov 19, 2024
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
2 changes: 2 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pr:
paths:
exclude:
- Docs
- .github/workflows/**
- .azure-pipelines.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two paths patterns are here for testing purposes only (since this PR modifies also files that match those patterns). They should be removed before merging the PR.


jobs:
- job:
Expand Down
51 changes: 19 additions & 32 deletions .github/workflows/clang_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@ on:
branches:
- "development"
pull_request:
paths-ignore:
- "Docs/**"

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-clangsanitizers
cancel-in-progress: true

jobs:
skip_checks:
name: Analyze
uses: ./.github/workflows/skip_checks.yml
with:
runs-on: ubuntu-latest
build_UB_sanitizer:
name: Clang UB sanitizer
runs-on: ubuntu-22.04
container: ubuntu:23.10
if: github.event.pull_request.draft == false
needs: skip_checks
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == 'false' }}
env:
CC: clang
CXX: clang++
# On CI for this test, Ninja is slower than the default:
#CMAKE_GENERATOR: Ninja
steps:
- uses: actions/checkout@v4
- name: install dependencies
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
.github/workflows/dependencies/clang17.sh
- name: CCache Cache
Expand All @@ -35,17 +40,15 @@ jobs:
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: build WarpX
- name: Build WarpX
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=100M
ccache -z

export CXX=$(which clang++-17)
export CC=$(which clang-17)
export CXXFLAGS="-fsanitize=undefined,address,pointer-compare -fno-sanitize-recover=all"

cmake -S . -B build \
-GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand All @@ -58,40 +61,35 @@ jobs:
-DWarpX_PRECISION=SINGLE \
-DWarpX_PARTICLE_PRECISION=SINGLE
cmake --build build -j 4

ccache -s
du -hs ~/.cache/ccache

- name: run with UB sanitizer
- name: Run with UB sanitizer
run: |

# We need these two lines because these tests run inside a docker container
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

export OMP_NUM_THREADS=2

#MPI implementations often leak memory
export "ASAN_OPTIONS=detect_leaks=0"

mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_base_1d
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_base_2d
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_base_3d

build_thread_sanitizer:
name: Clang thread sanitizer
runs-on: ubuntu-22.04
container: ubuntu:23.10
if: github.event.pull_request.draft == false
needs: skip_checks
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == 'false' }}
env:
CC: clang
CXX: clang++
# On CI for this test, Ninja is slower than the default:
#CMAKE_GENERATOR: Ninja
steps:
- uses: actions/checkout@v4
- name: install dependencies
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
.github/workflows/dependencies/clang17.sh
- name: CCache Cache
Expand All @@ -101,17 +99,15 @@ jobs:
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: build WarpX
- name: Build WarpX
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=100M
ccache -z

export CXX=$(which clang++-17)
export CC=$(which clang-17)
export CXXFLAGS="-fsanitize=thread"

cmake -S . -B build \
-GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand All @@ -125,7 +121,6 @@ jobs:
-DWarpX_PRECISION=DOUBLE \
-DWarpX_PARTICLE_PRECISION=DOUBLE
cmake --build build -j 4

cmake -S . -B build_EB \
-GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
Expand All @@ -139,30 +134,22 @@ jobs:
-DWarpX_PRECISION=DOUBLE \
-DWarpX_PARTICLE_PRECISION=DOUBLE
cmake --build build_EB -j 4

ccache -s
du -hs ~/.cache/ccache

- name: run with thread sanitizer
- name: Run with thread sanitizer
run: |
export PMIX_MCA_gds=hash
export TSAN_OPTIONS='ignore_noninstrumented_modules=1'
export ARCHER_OPTIONS="verbose=1"

# We need these two lines because these tests run inside a docker container
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

export OMP_NUM_THREADS=2

mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_base_rz warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_base_1d warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_base_2d warpx.serialize_initial_conditions = 0
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_base_3d warpx.serialize_initial_conditions = 0

git clone https://github.com/ECP-WarpX/warpx-data ../warpx-data
cd Examples/Tests/embedded_circle

ulimit -c unlimited

mpirun -n 2 ../../../build_EB/bin/warpx.2d inputs_test_2d_embedded_circle warpx.serialize_initial_conditions = 0
28 changes: 16 additions & 12 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,53 @@ on:
branches:
- "development"
pull_request:
paths-ignore:
- "Docs/**"

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-clangtidy
cancel-in-progress: true

jobs:
skip_checks:
name: Analyze
uses: ./.github/workflows/skip_checks.yml
with:
runs-on: ubuntu-latest
run_clang_tidy:
strategy:
matrix:
dim: [1, 2, RZ, 3]
name: clang-tidy-${{ matrix.dim }}D
runs-on: ubuntu-22.04
timeout-minutes: 180
if: github.event.pull_request.draft == false
needs: skip_checks
if: ${{ github.event.pull_request.draft == false }}
steps:
- uses: actions/checkout@v4
- name: install dependencies
- name: Checkout code
if: ${{ needs.skip_checks.outputs.skip == 'false' }}
uses: actions/checkout@v4
- name: Install dependencies
if: ${{ needs.skip_checks.outputs.skip == 'false' }}
run: |
.github/workflows/dependencies/clang15.sh
- name: set up cache
- name: Set up cache
if: ${{ needs.skip_checks.outputs.skip == 'false' }}
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: build WarpX & run clang-tidy
- name: Build WarpX & run clang-tidy
if: ${{ needs.skip_checks.outputs.skip == 'false' }}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=300M
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
ccache -z

export CXX=$(which clang++-15)
export CC=$(which clang-15)

cmake -S . -B build_clang_tidy \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DWarpX_DIMS="${{ matrix.dim }}" \
Expand All @@ -56,13 +63,10 @@ jobs:
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=SINGLE \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache

cmake --build build_clang_tidy -j 4

${{github.workspace}}/.github/workflows/source/makeMakefileForClangTidy.py --input ${{github.workspace}}/ccache.log.txt
make -j4 --keep-going -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"

ccache -s
du -hs ~/.cache/ccache
32 changes: 11 additions & 21 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@ concurrency:
cancel-in-progress: true

jobs:
skip_checks:
name: Analyze
uses: ./.github/workflows/skip_checks.yml
with:
runs-on: ubuntu-latest
analyze:
name: Analyze
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
needs: skip_checks
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == 'false' }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ python, cpp ]

steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Packages (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
sudo apt-get update
sudo apt-get install --yes cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libadios-openmpi-dev ccache

python -m pip install --upgrade pip
python -m pip install --upgrade pipx
python -m pip install --upgrade wheel
python -m pip install --upgrade cmake
python -m pipx install cmake

- name: Set Up Cache
if: ${{ matrix.language == 'cpp' }}
uses: actions/cache@v4
Expand All @@ -56,48 +56,39 @@ jobs:
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-

- name: Configure (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
cmake -S . -B build -DWarpX_OPENPMD=ON

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/warpx-codeql.yml
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Build (py)
uses: github/codeql-action/autobuild@v3
if: ${{ matrix.language == 'python' }}

uses: github/codeql-action/autobuild@v3
- name: Build (C++)
if: ${{ matrix.language == 'cpp' }}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
export CCACHE_MAXSIZE=100M
ccache -z

cmake --build build -j 4

ccache -s
du -hs ~/.cache/ccache

# Make sure CodeQL has something to do
touch Source/Utils/WarpXVersion.cpp
export CCACHE_DISABLE=1
cmake --build build -j 4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
upload: False
output: sarif-results

- name: filter-sarif
uses: advanced-security/filter-sarif@v1
with:
Expand All @@ -111,7 +102,6 @@ jobs:
-build/_deps/*/*/*/*/*/*/*/*
input: sarif-results/${{ matrix.language }}.sarif
output: sarif-results/${{ matrix.language }}.sarif

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
Loading