From b0c0631bb48dd550c3814aedd9c1c20268575f22 Mon Sep 17 00:00:00 2001 From: Marc Scheib Date: Sun, 24 Sep 2023 16:31:31 +0200 Subject: [PATCH] ci: adapt pull request workflow --- .../workflows/pull-request_cache-cleanup.yml | 27 +++++++++++++++++-- .github/workflows/pull-request_test-build.yml | 22 +++++++++++---- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request_cache-cleanup.yml b/.github/workflows/pull-request_cache-cleanup.yml index c3e7fae..fd66de6 100644 --- a/.github/workflows/pull-request_cache-cleanup.yml +++ b/.github/workflows/pull-request_cache-cleanup.yml @@ -8,5 +8,28 @@ on: jobs: cleanup: - name: Cleanup - uses: CycriLabs/eam-gha-workflows/.github/workflows/be-fe_pull-request_cache-cleanup.yml@main + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH=${{ github.ref }} + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | 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 }} diff --git a/.github/workflows/pull-request_test-build.yml b/.github/workflows/pull-request_test-build.yml index bf6efb8..3c3cbe5 100644 --- a/.github/workflows/pull-request_test-build.yml +++ b/.github/workflows/pull-request_test-build.yml @@ -9,8 +9,20 @@ concurrency: jobs: test-and-build: - name: Test and build - uses: CycriLabs/eam-gha-workflows/.github/workflows/be_pull-request_test-build.yml@main - secrets: inherit - with: - java-version: 17 + runs-on: ubuntu-latest + + steps: + - name: Checkout [${{ github.head_ref || github.ref_name }}] + uses: actions/checkout@v3 + + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + distribution: 'graalvm' + java-version: '17' + components: 'native-image' + cache: 'maven' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Test project + run: mvn -B package