Skip to content
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
47 changes: 47 additions & 0 deletions .github/workflows/cache-maven-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Cache Maven Dependencies"
permissions:
contents: read

on:
workflow_dispatch:
schedule:
- cron: '57 4 * * Sun'

env:
MAVEN_CACHE_REF: refs/heads/main
MAVEN_CACHE_KEY: maven-dependencies
MAVEN_CACHE_DIR: ~/.m2

jobs:
update-cache:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v5
with:
ref: ${{ env.MAVEN_CACHE_REF }}

- name: "Setup Java"
uses: actions/setup-java@v5
with:
distribution: "sapmachine"
java-version: 17

- name: "Download Dependencies"
run: mvn -B dependency:go-offline

- name: "Delete Existing Caches"
run: |
CACHE_IDS=$(gh cache list --key "${{ env.MAVEN_CACHE_KEY }}" --ref "${{ env.MAVEN_CACHE_REF }}" --json id | jq -r '.[] | .id')
for CACHE_ID in $CACHE_IDS; do
echo "Deleting cache with ID: $CACHE_ID"
gh cache delete "${CACHE_ID}"
done
env:
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}

- name: "Cache Dependencies"
uses: actions/cache/save@v4
with:
path: ${{ env.MAVEN_CACHE_DIR }}
key: ${{ env.MAVEN_CACHE_KEY }}
10 changes: 10 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ env:
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
MVN_SKIP_CI_PLUGINS: -DskipFormatting -Denforcer.skip -Djacoco.skip -Dmdep.analyze.skip
JAVA_VERSION: 17
# keep the following two variables in sync with our 'cache-maven-dependencies.yaml' workflow
MAVEN_CACHE_KEY: maven-dependencies
MAVEN_CACHE_DIR: ~/.m2

jobs:

Expand All @@ -33,6 +36,13 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'

- name: "Restore Dependencies"
id: restore-dependencies
uses: actions/cache/restore@v4
with:
key: ${{ env.MAVEN_CACHE_KEY }}
path: ${{ env.MAVEN_CACHE_DIR }}

- name: "REUSE Compliance Check"
uses: fsfe/reuse-action@v5

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/spec-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
env:
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
JAVA_VERSION: 17
# keep the following two variables in sync with our 'cache-maven-dependencies.yaml' workflow
MAVEN_CACHE_KEY: maven-dependencies
MAVEN_CACHE_DIR: ~/.m2

jobs:
generate:
Expand Down Expand Up @@ -59,6 +62,13 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'

- name: "Restore Dependencies"
id: restore-dependencies
uses: actions/cache/restore@v4
with:
key: ${{ env.MAVEN_CACHE_KEY }}
path: ${{ env.MAVEN_CACHE_DIR }}

- name: "Checkout or Create Branch"
id: branch
# Checkout branch if it exists, otherwise create it
Expand Down
Loading