Skip to content

Commit

Permalink
use runs-on/cache to write GH caches to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilkins-csi committed Nov 5, 2024
1 parent 81fe8f4 commit 3a107bf
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ jobs:
runs-on: arc-runner-set-aissemble
env:
DOCKER_CONFIG: /home/runner/.docker
RUNS_ON_S3_BUCKET_CACHE: aissemble-github-cache
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.buildBranch }}
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.S3_CACHE_USER }}
aws-region: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true
# 3 hours, as our nightly takes ~ 2
role-duration-seconds: 10800
- name: clear cache on nightly build
if: ${{ github.event.schedule }}
uses: actions/github-script@v6
Expand Down Expand Up @@ -57,23 +66,23 @@ jobs:
#NB: We restore/save cache manually so that we save the cache even if the build fails
- name: Load docker build cache
id: cached-docker-build
uses: actions/cache/restore@v4
uses: runs-on/cache/restore@v4
with:
path: ~/.docker/cache
key: docker-cache-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
docker-cache-
- name: Load m2 repository cache # Manually caching .m2 repo as the setup-java caching isn't falling back to older caches
id: cached-m2-repo
uses: actions/cache/restore@v4
uses: runs-on/cache/restore@v4
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: Load m2 build cache
id: cached-m2-build
uses: actions/cache/restore@v4
uses: runs-on/cache/restore@v4
with:
path: ~/.m2/build-cache
key: maven-build-cache-${{ hashFiles('**/pom.xml') }}
Expand All @@ -82,7 +91,7 @@ jobs:
#NB: Not saving poetry cache on failure in case it's a failure caused by an in-flight python package release
- name: Poetry cache
id: cached-poetry
uses: actions/cache@v4
uses: runs-on/cache@v4
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ hashFiles('**/pyproject.toml') }}
Expand All @@ -107,21 +116,21 @@ jobs:
./mvnw -B clean install -Parchetype-test -pl :foundation-archetype
- name: Save docker build cache
id: save-docker-build
uses: actions/cache/save@v4
uses: runs-on/cache/save@v4
if: always() && steps.cached-docker-build.outputs.cache-hit != 'true'
with:
path: ~/.docker/cache
key: docker-cache-${{ hashFiles('**/Dockerfile') }}
- name: Save m2 repository cache
id: save-m2-repo
uses: actions/cache/save@v4
uses: runs-on/cache/save@v4
if: always() && steps.cached-m2-repo.outputs.cache-hit != 'true'
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
- name: Save m2 build cache
id: save-m2-build
uses: actions/cache/save@v4
uses: runs-on/cache/save@v4
if: always() && steps.cached-m2-build.outputs.cache-hit != 'true'
with:
path: ~/.m2/build-cache
Expand Down

0 comments on commit 3a107bf

Please sign in to comment.