-
-
Notifications
You must be signed in to change notification settings - Fork 34
50 lines (49 loc) · 1.72 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Build and Test
on: [workflow_dispatch]
jobs:
run-unit-tests:
runs-on: macos-13
env:
XC_VERSION: ${{ '15.1' }}
# CCACHE_DIR: "~/.ccache"
CCACHE_COMPRESS: "true"
CCACHE_COMPRESSLEVEL: "10"
CCACHE_MAXSIZE: "400M"
strategy:
matrix:
configuration: ["Debug", "Release"]
steps:
- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"
- name: Install ccache
run: "brew install ccache"
- name: Check ccache
run: "which ccache"
- name: Cache ccache
uses: actions/cache@v2
with:
path: ~/Library/Caches/ccache
key: ccache-${{ github.job }}-${{ matrix.configuration }}-${{ github.run_id }}
restore-keys: ccache-${{ github.job }}-${{ matrix.configuration }}
- uses: actions/checkout@v2
- name: Build and run unit tests
run: "cd Scripts && ./run_all_unit_tests.sh ${{ matrix.configuration }}"
- name: Show ccache stats
run: "ccache --show-stats --verbose"
- name: Remove old ccache caches
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeys=$(gh actions-cache list --key ccache-${{ github.job }}-${{ matrix.configuration }}- | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeys
do
gh actions-cache delete $cacheKey --confirm
done
echo "Done"
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# REPO: ${{ github.repository }}
# BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge