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

Simplify cache cleanup actions #5215

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 0 additions & 15 deletions .github/workflows/clang_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,3 @@ jobs:
ulimit -c unlimited

mpirun -n 2 ../../../build_EB/bin/warpx.2d inputs_2d warpx.serialize_initial_conditions = 0

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
15 changes: 0 additions & 15 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,3 @@ jobs:

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

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
7 changes: 5 additions & 2 deletions .github/workflows/cleanup-cache-postpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ jobs:

REPO=${{ github.repository }}

gh run download ${{ github.event.workflow_run.id }} -n pr_number
pr_number=`cat pr_number.txt`
# For debugging cat ${GITHUB_EVENT_PATH} to see the payload.

pr_head_sha=${{ github.event.workflow_run.head_sha }}
pr_number=$(gh pr list --state all --search $pr_head_sha --json number --jq '.[0].number')
echo "Post-PR cache cleanup for PR ${pr_number}"
BRANCH=refs/pull/${pr_number}/merge

# Setting this to not fail the workflow while deleting cache keys.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/cleanup-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ jobs:
# Triggering workflow run name (e.g., LinuxClang)
WORKFLOW_NAME="${{ github.event.workflow_run.name }}"

# For debugging, cat ${GITHUB_EVENT_PATH} to see the payload.

if [[ $EVENT == "pull_request" ]]; then
gh run download ${{ github.event.workflow_run.id }} -n pr_number
pr_number=`cat pr_number.txt`
pr_head_sha=${{ github.event.workflow_run.head_sha }}
pr_number=$(gh pr list --search $pr_head_sha --json number --jq '.[0].number')
echo "Clean up cache for PR ${pr_number}"
BRANCH=refs/pull/${pr_number}/merge
else
BRANCH=refs/heads/${{ github.event.workflow_run.head_branch }}
Expand All @@ -54,6 +57,7 @@ jobs:
IFS=$'\n'
for j in $cached_jobs
do
# Delete all entries except the last used one
old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key "${j}-git-" --sort last-used | cut -f 1 | tail -n +2)
for k in $old_keys
do
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,3 @@ jobs:
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
15 changes: 0 additions & 15 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,3 @@ jobs:

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

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
15 changes: 0 additions & 15 deletions .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,3 @@ jobs:

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

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
15 changes: 0 additions & 15 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,3 @@ jobs:
# python3 -m pip install --upgrade build packaging setuptools wheel
# PYWARPX_LIB_DIR=$PWD/build_sp/lib/site-packages/pywarpx/ python3 -m pip wheel .
# python3 -m pip install *.whl

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
15 changes: 0 additions & 15 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,3 @@ jobs:
export OMP_NUM_THREADS=1

mpirun -n 2 Examples/Physics_applications/laser_acceleration/PICMI_inputs_3d.py

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
18 changes: 7 additions & 11 deletions .github/workflows/post-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ on:
types:
- closed

# This workflow does not have the permission to clean up cache for PRs
# originated from a fork. The purpose here is to trigger a workflow_run
# cleanup-cache-postpr.yml that has the right permission.

jobs:
cleanup:
noop:
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
- name: No OP
run: echo "This workflow is going to trigger CleanUpCachePostPR."
15 changes: 0 additions & 15 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,3 @@ jobs:
run: |
export OMP_NUM_THREADS=1
mpirun -n 2 Examples/Physics_applications/laser_acceleration/PICMI_inputs_3d.py

save_pr_number:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo $PR_NUMBER > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
retention-days: 1
Loading