From d15b6f2b51e6be7c412b4ebb9d8be640ce4e5cf2 Mon Sep 17 00:00:00 2001 From: MASES Public Developers Team <94312179+masesdevelopers@users.noreply.github.com> Date: Wed, 15 May 2024 12:00:20 +0200 Subject: [PATCH] Use HEAD SHA to track caches (#174) --- .github/workflows/linux.yaml | 10 +++++++--- .github/workflows/windows.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index aa8dac40f8..72572dab0f 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -88,12 +88,16 @@ jobs: - name: Build JAR files run: dotnet bin/net8.0/MASES.JCOReflectorCLI.dll -JobType CreateJars -JDKFolder $JAVA_HOME_11_X64 -JobFile .github/workflows/createjars_net8.0_linux.job + - name: Extract commit SHA + run: | + echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV + - name: Save JCOReflector bin in cache uses: actions/cache/save@v4 with: enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_linux_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_linux_bin_${{ env.GITHUB_SHA }} execute_java_tests: @@ -121,7 +125,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_linux_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_linux_bin_${{ env.GITHUB_SHA }} - name: Set up JDK distribution uses: actions/setup-java@v4 @@ -207,7 +211,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_linux_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_linux_bin_${{ env.GITHUB_SHA }} - name: Set up JDK distribution uses: actions/setup-java@v4 diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 04b8fafe41..331d21966f 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -133,14 +133,14 @@ jobs: with: enableCrossOsArchive: true path: ./src/jvm/ - key: JCOReflector_source_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_source_${{ env.GITHUB_SHA }} - name: Save JCOReflector bin in cache uses: actions/cache/save@v4 with: enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_windows_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_windows_bin_${{ env.GITHUB_SHA }} execute_java_tests: needs: build_windows @@ -173,7 +173,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_windows_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_windows_bin_${{ env.GITHUB_SHA }} - name: Set up JDK distribution uses: actions/setup-java@v4 @@ -272,7 +272,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_windows_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_windows_bin_${{ env.GITHUB_SHA }} - name: Set up JDK distribution uses: actions/setup-java@v4 @@ -379,7 +379,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./bin/ - key: JCOReflector_windows_bin_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_windows_bin_${{ env.GITHUB_SHA }} - name: Restore JCOReflector source from cache uses: actions/cache/restore@v4 @@ -387,7 +387,7 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true path: ./src/jvm/ - key: JCOReflector_source_${{ github.run_id }}_${{ github.run_attempt }} + key: JCOReflector_source_${{ env.GITHUB_SHA }} - name: Compress release files run: | @@ -399,7 +399,7 @@ jobs: run: | echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV shell: bash - + - name: Commit statistics changes if: ${{ github.repository_owner == 'masesgroup'}} #do not push any changes outside main repo uses: EndBug/add-and-commit@v9