Skip to content

Commit

Permalink
Enable ccache for advanced.yml (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex authored Aug 8, 2024
1 parent 9a9eac5 commit 7a98730
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion .github/workflows/advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ env:
TOOLCHAIN_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-toolchain.tar.gz

SOURCE_PATH: ${{ github.workspace }}/code
BUILD_PATH: ${{ github.workspace }}/build
CCACHE_DIR_PATH: ${{ github.workspace }}/ccache
ARTIFACT_PATH: ${{ github.workspace }}/artifact

CCACHE: 1
DELETE_BUILD: 1

jobs:
Expand Down Expand Up @@ -261,6 +264,20 @@ jobs:
run: |
.github/scripts/install-libraries.sh
- name: Get cache key
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
id: get-cache-key
run: |
echo "timestamp=$(date -u --iso-8601=seconds)" >> "$GITHUB_OUTPUT"
- name: Restore Ccache
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR_PATH }}
key: advanced-gcc-ccache-${{ steps.get-cache-key.outputs.timestamp }}
restore-keys: advanced-gcc-ccache-

- name: Build binutils
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
run: |
Expand Down Expand Up @@ -331,6 +348,13 @@ jobs:
run: |
.github/scripts/toolchain/build-cygwin.sh 2
- name: Save Ccache
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && always() }}
uses: actions/cache/save@v4
with:
path: ${{ env.CCACHE_DIR_PATH }}
key: advanced-gcc-ccache-${{ steps.get-cache-key.outputs.timestamp }}

- name: Pack toolchain
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && env.PACK_TOOLCHAIN == 'true' }}
run: |
Expand All @@ -340,7 +364,15 @@ jobs:
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && env.PACK_TOOLCHAIN != 'true' }}
run: |
.github/scripts/toolchain/pack-mock.sh
- name: Upload build folder
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' && failure() }}
uses: actions/upload-artifact@v4
with:
name: build
retention-days: 1
path: ${{ env.BUILD_PATH }}

- name: Upload artifact
if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' || env.PACK_TOOLCHAIN == 'true' }}
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 7a98730

Please sign in to comment.