Skip to content

Commit

Permalink
Debugging: use separate bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Nov 19, 2024
1 parent 3c88431 commit 9db880f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 59 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/check_diff.yml

This file was deleted.

30 changes: 20 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,37 @@ concurrency:
cancel-in-progress: true

jobs:

skip_checks:
name: Skip checks?
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run PR analysis script
run: |
.github/workflows/scripts/check_diff.sh \
${{ github.event.pull_request.head.ref }} \
${{ github.event.pull_request.base.ref }} \
${{ github.event.pull_request.head.repo.clone_url }}
outputs:
skip: ${{ env.SKIP_CHECKS }}

build_appleclang:
name: AppleClang
runs-on: macos-latest
needs: skip_checks
if: ${{ github.event.pull_request.draft == false && needs.skip_checks.outputs.skip == false }}
steps:
- name: Run PR analysis
uses: ./.github/workflows/pr-analysis.yml
id: pr_analysis
- name: Checkout code
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
uses: actions/checkout@v4
- name: Install Python
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install brew dependencies
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
run: |
set +e
brew unlink gcc
Expand All @@ -41,22 +55,19 @@ jobs:
brew tap openpmd/openpmd
brew install openpmd-api
- name: Install pip dependencies
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build packaging setuptools wheel
python3 -m pip install --upgrade mpi4py
python3 -m pip install --upgrade -r Regression/requirements.txt
- name: CCache Cache
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
uses: actions/cache@v4
with:
path: ~/Library/Caches/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-git-
- name: Build WarpX
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
run: |
export CCACHE_COMPRESS=1
export CCACHE_COMPRESSLEVEL=10
Expand Down Expand Up @@ -86,7 +97,6 @@ jobs:
du -hs ~/Library/Caches/ccache
ccache -s
- name: Run pywarpx
if: ${{ github.event.pull_request.draft == false && steps.pr_analysis.outputs.skip == "false" }}
run: |
export OMP_NUM_THREADS=1
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/scripts/check_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

# Parse command line arguments
head_ref=${1}
base_ref=${2}
clone_url=${3}

# Set paths to ignore
paths_ignore="^(Docs|\.github)/|\.azure-pipelines\.yml$"

# Add forked repository as remote
git remote add fork ${clone_url}

# Fetch base branch from main repository
git fetch origin ${base_ref}

# Fetch head branch from forked repository
git fetch fork ${head_ref}

# Save output of git diff to inspect files changed
git diff --name-only --diff-filter=ACMRTUXB origin/${base_ref}..fork/${head_ref} > check_diff.txt

# Set skip variable after inspecting files changed
skip=$(grep -v -E "${paths_ignore}" check_diff.txt)

# Set an environment variable based on the output
if [ -z "$skip" ]; then
echo "SKIP_CHECKS=true" >> $GITHUB_ENV
else
echo "SKIP_CHECKS=false" >> $GITHUB_ENV
fi

0 comments on commit 9db880f

Please sign in to comment.