-
Notifications
You must be signed in to change notification settings - Fork 79
229 lines (198 loc) · 6.94 KB
/
scheduled.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Scheduled
run-name: Scheduled Repository Actions ⏰
on:
schedule:
- cron: 12 0 * * *
permissions:
contents: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
cache-cleanup:
name: Cache Cleanup 🧹
runs-on: ubuntu-22.04
permissions:
actions: write
steps:
- name: Remove Stale Cache Entries
env:
GH_TOKEN: ${{ github.token }}
run: |
: Remove Stale Cache Entries
echo '::group::Processing master branch cache entries'
while IFS=";" read -r cache_id cache_name; do
if [[ "${cache_name}" ]]; then
result=true
gh api -X DELETE repos/${GITHUB_REPOSITORY}/actions/caches?key=${cache_name} --jq '.total_count' &> /dev/null || result=false
if ${result}; then
echo "Deleted cache entry ${cache_name}"
else
echo "::warning::Unable to delete cache entry ${cache_name}"
fi
fi
done <<< \
"$(gh api repos/${GITHUB_REPOSITORY}/actions/caches \
--jq '.actions_caches.[] | select(.ref|test("refs/heads/master")) | select(.key|test(".*-ccache-*")) | {id, key} | join(";")')"
while IFS=";" read -r cache_id cache_name; do
if [[ "${cache_name}" ]]; then
result=true
gh api -X DELETE repos/${GITHUB_REPOSITORY}/actions/caches?key=${cache_name} --jq '.total_count' &> /dev/null || result=false
if ${result}; then
echo "Deleted cache entry ${cache_name}"
else
echo "::warning::Unable to delete cache entry ${cache_name}"
fi
fi
done <<< \
"$(gh api repos/${GITHUB_REPOSITORY}/actions/caches \
--jq '.actions_caches.[] | select(.ref|test("refs/heads/master")) | select(.key|test(".+-(qt6|deps)-.+")) | select(.key|test(".+ffmpeg.+")|not) | {id, key} | join(";")')"
echo '::endgroup::'
echo '::group::Processing pull request cache entries'
while IFS=";" read -r cache_id cache_name cache_ref; do
if [[ "${cache_name}" ]]; then
result=true
gh api -X DELETE repos/${GITHUB_REPOSITORY}/actions/caches?key=${cache_name} --jq '.total_count' &> /dev/null || result=false
pr_number=$(echo ${cache_ref} | cut -d '/' -f 3)
if ${result}; then
echo "Deleted PR #${pr_number} cache entry ${cache_name}"
else
echo "::warning::Unable to delete PR #${pr_number} cache entry ${cache_name}"
fi
fi
done <<< \
"$(gh api 'repos/${GITHUB_REPOSITORY}/actions/caches?per_page=100' \
--jq '.actions_caches.[] | select(.ref|test("refs/heads/master")|not) | {id, key, ref} | join(";")' &> /dev/null)"
echo '::endgroup::'
macos-build:
name: Build macOS Dependencies
runs-on: macos-13
strategy:
fail-fast: true
matrix:
target: [macos-arm64, macos-x86_64]
include:
- target: macos-arm64
config: Release
type: static
- target: macos-x86_64
config: Release
type: static
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Environment
id: setup
run: |
: Setup Environment
to_remove=()
for formula (llvm gcc) {
if [[ -d /usr/local/opt/"${formula}" ]] to_remove+=(${formula})
}
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
local -r date_string=$(date +"%Y-%m-%d")
print "ccacheDate=${date_string}" >> $GITHUB_OUTPUT
- name: Restore Compilation Cache
id: ccache-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.ccache
key: ${{ matrix.target }}-ccache-deps-${{ matrix.config }}-${{ steps.setup.outputs.ccacheDate }}
restore-keys: |
${{ matrix.target }}-ccache-deps-${{ matrix.config }}-
- name: Build macOS Dependencies
uses: ./.github/actions/build-deps
with:
target: ${{ matrix.target }}
type: ${{ matrix.type }}
config: ${{ matrix.config }}
windows-build:
name: Build Windows Dependencies
runs-on: windows-2022
strategy:
fail-fast: true
matrix:
target: [x64, x86]
include:
- target: x64
config: Release
type: static
- target: x86
config: Release
type: static
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build ntv2 Debug
if: matrix.target == 'x64'
shell: pwsh
run: |
# Build ntv2 Debug
$Params = @{
Target = '${{ matrix.target }}'
Configuration = 'Debug'
Dependencies = 'ntv2'
}
./Build-Dependencies.ps1 @Params
Remove-Item -Recurse -Force ${{ github.workspace }}/windows_build_temp
- name: Build Windows Dependencies
uses: ./.github/actions/build-deps
with:
target: ${{ matrix.target }}
type: ${{ matrix.type }}
config: ${{ matrix.config }}
macos-qt6-build:
name: Build Qt6 (macOS)
runs-on: macos-13
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Environment
id: setup
run: |
: Setup Environment
local -a to_remove=()
for formula (llvm gcc) {
if [[ -d /usr/local/opt/"${formula}" ]] to_remove+=(${formula})
}
if (( #to_remove )) brew uninstall --ignore-dependencies ${to_remove}
local -r date_string=$(date +"%Y-%m-%d")
print "ccacheDate=${date_string}" >> $GITHUB_OUTPUT
- name: Restore Compilation Cache
id: ccache-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.ccache
key: macos-universal-ccache-qt6-${{ steps.setup.outputs.ccacheDate }}
restore-keys: |
macos-universal-ccache-qt6-
- name: Build macOS Qt
uses: ./.github/actions/build-qt
with:
target: macos-universal
config: Release
windows-qt6-build:
name: Build Qt6 (Windows)
runs-on: windows-2022
strategy:
fail-fast: true
matrix:
target: [x64, x86]
config: [RelWithDebInfo, Debug]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Windows Qt
uses: ./.github/actions/build-qt
with:
target: ${{ matrix.target }}
config: ${{ matrix.config }}