Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng committed Sep 1, 2024
1 parent 66f707e commit 656769f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ jobs:
version: ${{ steps.read_toml.outputs.value }}
- name: Restore Julia packages
uses: actions/cache/restore@v4
if: ${{ contains(runner.name, 'GitHub Actions') }}
if: ${{ runner.environment == 'github-hosted' }}
id: cache-julia
with:
path: |
~/.julia
!~/.julia/registries
path: ~/.julia
key: ${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ steps.read_toml.outputs.value }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml') }}
restore-keys: |
${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ steps.read_toml.outputs.value }}-
Expand All @@ -74,14 +72,11 @@ jobs:
Pkg.activate(".")
Pkg.instantiate()
Pkg.precompile()
Pkg.gc(collect_delay=Day(0))
- name: Save Julia packages
uses: actions/cache/save@v4
if: ${{ contains(runner.name, 'GitHub Actions') && steps.cache-julia.outputs.cache-hit != 'true' }}
if: ${{ runner.environment == 'github-hosted' && steps.cache-julia.outputs.cache-hit != 'true' }}
with:
path: |
~/.julia
!~/.julia/registries
path: ~/.julia
key: ${{ steps.cache-julia.outputs.cache-primary-key }}
- name: Run notebooks
run: julia --color=yes -p ${{ env.LITERATE_PROC }} --heap-size-hint=3G run.jl
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/clear-main-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Clear main caches
on:
workflow_dispatch:

jobs:
cleanup:
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ github.event.repository.default_branch }}
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Update Julia dependencies
env:
JULIA_PKG_PRECOMPILE_AUTO: '0'
run: julia --project=@. --color=yes -e 'import Pkg; Pkg.update()'
run: julia --project=@. --color=yes -e 'using Pkg; Pkg.update()'
# Authenticate with a custom GitHub APP
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
- name: Generate token for PR
Expand Down

0 comments on commit 656769f

Please sign in to comment.