Skip to content

Commit 9db880f

Browse files
committed
Debugging: use separate bash script
1 parent 3c88431 commit 9db880f

File tree

3 files changed

+55
-59
lines changed

3 files changed

+55
-59
lines changed

.github/workflows/check_diff.yml

-49
This file was deleted.

.github/workflows/macos.yml

+20-10
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,37 @@ concurrency:
88
cancel-in-progress: true
99

1010
jobs:
11+
12+
skip_checks:
13+
name: Skip checks?
14+
runs-on: macos-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Run PR analysis script
21+
run: |
22+
.github/workflows/scripts/check_diff.sh \
23+
${{ github.event.pull_request.head.ref }} \
24+
${{ github.event.pull_request.base.ref }} \
25+
${{ github.event.pull_request.head.repo.clone_url }}
26+
outputs:
27+
skip: ${{ env.SKIP_CHECKS }}
28+
1129
build_appleclang:
1230
name: AppleClang
1331
runs-on: macos-latest
32+
needs: skip_checks
33+
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == false }}
1434
steps:
15-
- name: Run PR analysis
16-
uses: ./.github/workflows/pr-analysis.yml
17-
id: pr_analysis
1835
- name: Checkout code
19-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
2036
uses: actions/checkout@v4
2137
- name: Install Python
22-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
2338
uses: actions/setup-python@v5
2439
with:
2540
python-version: '3.x'
2641
- name: Install brew dependencies
27-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
2842
run: |
2943
set +e
3044
brew unlink gcc
@@ -41,22 +55,19 @@ jobs:
4155
brew tap openpmd/openpmd
4256
brew install openpmd-api
4357
- name: Install pip dependencies
44-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
4558
run: |
4659
python3 -m pip install --upgrade pip
4760
python3 -m pip install --upgrade build packaging setuptools wheel
4861
python3 -m pip install --upgrade mpi4py
4962
python3 -m pip install --upgrade -r Regression/requirements.txt
5063
- name: CCache Cache
51-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
5264
uses: actions/cache@v4
5365
with:
5466
path: ~/Library/Caches/ccache
5567
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
5668
restore-keys: |
5769
ccache-${{ github.workflow }}-${{ github.job }}-git-
5870
- name: Build WarpX
59-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
6071
run: |
6172
export CCACHE_COMPRESS=1
6273
export CCACHE_COMPRESSLEVEL=10
@@ -86,7 +97,6 @@ jobs:
8697
du -hs ~/Library/Caches/ccache
8798
ccache -s
8899
- name: Run pywarpx
89-
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
90100
run: |
91101
export OMP_NUM_THREADS=1
92102
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -o nounset
4+
set -o errexit
5+
set -o pipefail
6+
7+
# Parse command line arguments
8+
head_ref=${1}
9+
base_ref=${2}
10+
clone_url=${3}
11+
12+
# Set paths to ignore
13+
paths_ignore="^(Docs|\.github)/|\.azure-pipelines\.yml$"
14+
15+
# Add forked repository as remote
16+
git remote add fork ${clone_url}
17+
18+
# Fetch base branch from main repository
19+
git fetch origin ${base_ref}
20+
21+
# Fetch head branch from forked repository
22+
git fetch fork ${head_ref}
23+
24+
# Save output of git diff to inspect files changed
25+
git diff --name-only --diff-filter=ACMRTUXB origin/${base_ref}..fork/${head_ref} > check_diff.txt
26+
27+
# Set skip variable after inspecting files changed
28+
skip=$(grep -v -E "${paths_ignore}" check_diff.txt)
29+
30+
# Set an environment variable based on the output
31+
if [ -z "$skip" ]; then
32+
echo "SKIP_CHECKS=true" >> $GITHUB_ENV
33+
else
34+
echo "SKIP_CHECKS=false" >> $GITHUB_ENV
35+
fi

0 commit comments

Comments
 (0)