Skip to content

Commit 000e72f

Browse files
committed
修改 action;
1 parent 18da551 commit 000e72f

File tree

7 files changed

+248
-41
lines changed

7 files changed

+248
-41
lines changed

.github/workflows/clean_cache.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Cleanup caches by a branch
2+
on:
3+
# 每周一 0 点触发
4+
schedule:
5+
- cron: '0 0 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
cleanup:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
# `actions:write` permission is required to delete caches
13+
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
14+
actions: write
15+
contents: read
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Cleanup
21+
run: |
22+
gh extension install actions/gh-actions-cache
23+
24+
REPO=${{ github.repository }}
25+
BRANCH=${{ github.ref }}
26+
27+
echo "Fetching list of cache key"
28+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
29+
30+
## Setting this to not fail the workflow while deleting cache keys.
31+
set +e
32+
echo "Deleting caches..."
33+
for cacheKey in $cacheKeysForPR
34+
do
35+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
36+
done
37+
echo "Done"
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+

.github/workflows/cmake.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ on:
44
# push代码时触发workflow
55
push:
66
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
7+
- '.github/workflows/clean_cache.yml'
8+
- '.github/workflows/delete_workflow.yml'
9+
- '.github/workflows/qmake.yml'
10+
- '.github/workflows/readme.yml'
11+
- '.github/workflows/toolchain.yml'
712
- 'doc/**'
813
- '.clang-*'
914
- '.gitignore'
1015
- 'LICENSE'
1116
- 'README*'
1217
pull_request:
1318
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
19+
- '.github/workflows/clean_cache.yml'
20+
- '.github/workflows/delete_workflow.yml'
21+
- '.github/workflows/qmake.yml'
22+
- '.github/workflows/readme.yml'
23+
- '.github/workflows/toolchain.yml'
1424
- 'doc/**'
1525
- '.clang-*'
1626
- '.gitignore'
@@ -29,23 +39,26 @@ jobs:
2939
- macos-latest
3040
- ubuntu-latest
3141
qt_ver:
32-
- 6.5.2
42+
- 6.6.1
3343
build_type:
3444
- "RelWithDebInfo"
3545
generators:
3646
- "Ninja"
3747

3848
steps:
39-
- name: cache vcpkg
40-
uses: actions/cache@v3
41-
with:
42-
path: |
43-
C:\vcpkg\installed
44-
/usr/local/share/vcpkg/installed
45-
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ github.sha }}
46-
restore-keys: |
47-
${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
48-
${{ runner.os }}-vcpkg-installed-
49+
- name: Restore windows vcpkg
50+
if: startsWith(matrix.os, 'windows')
51+
uses: actions/cache/restore@v3
52+
with:
53+
path: C:\vcpkg\installed
54+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
55+
- name: Restore macos or ubuntu vcpkg
56+
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
57+
uses: actions/cache/restore@v3
58+
with:
59+
path: /usr/local/share/vcpkg/installed
60+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
61+
4962
- name: Install dependencies on windows
5063
if: startsWith(matrix.os, 'windows')
5164
shell: bash
@@ -79,10 +92,10 @@ jobs:
7992
with:
8093
version: ${{ matrix.qt_ver }}
8194
install-deps: 'true'
82-
modules: 'qt5compat addons.qtserialport addons.qtnetworkauth addons.qtmultimedia addons.qtimageformats'
95+
modules: 'qt5compat qtserialport qtnetworkauth qtmultimedia qtimageformats'
8396
cache: 'true'
8497

85-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
8699
with:
87100
fetch-depth: 1
88101

@@ -180,16 +193,16 @@ jobs:
180193
rm -f ./bin-64/${{ matrix.build_type }}/*.so
181194
mv *.AppImage ./bin-64/${{ matrix.build_type }}
182195
183-
- name: Show Upload files
196+
- name: 7z package
184197
shell: bash
185198
run: |
186-
ls -l ./bin-64/${{ matrix.build_type }}
199+
ls -al ./bin-64/${{ matrix.build_type }}
200+
7z a -t7z -r -mx=9 -mmt Qt-App-${{ matrix.os }}-${{ matrix.build_type }}.7z ./bin-64/${{ matrix.build_type }}/*
187201
- name: Upload packages
188202
uses: actions/upload-artifact@v3
189203
with:
190204
name: ${{ matrix.os }}-${{ matrix.build_type }}
191-
path: |
192-
./bin-64/${{ matrix.build_type }}
205+
path: Qt-App-${{ matrix.os }}-${{ matrix.build_type }}.7z
193206

194207
release:
195208
name: Release
@@ -201,14 +214,15 @@ jobs:
201214
steps:
202215
- name: Download packages
203216
uses: actions/download-artifact@v3
204-
- name: Zip packages
217+
218+
- name: Move packages
205219
shell: bash
206220
run: |
207-
ls -l
208-
zip -9 -r Qt-App-Windows.zip windows-latest-RelWithDebInfo
209-
zip -9 -r Qt-App-MacOS.zip macos-latest-RelWithDebInfo
210-
zip -9 -r Qt-App-Ubuntu.zip ubuntu-latest-RelWithDebInfo
211-
ls -l
221+
ls -al
222+
mv ./windows-latest-RelWithDebInfo/Qt-App-*.7z .
223+
mv ./macos-latest-RelWithDebInfo/Qt-App-*.7z .
224+
mv ./ubuntu-latest-RelWithDebInfo/Qt-App-*.7z .
225+
ls -al
212226
213227
- name: Create Release
214228
uses: softprops/action-gh-release@v1
@@ -217,4 +231,4 @@ jobs:
217231
prerelease: false
218232
generate_release_notes: true
219233
files: |
220-
*.zip
234+
*.7z
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Delete old workflow runs
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
days:
6+
description: 'Days-worth of runs to keep for each workflow'
7+
required: true
8+
default: '30'
9+
minimum_runs:
10+
description: 'Minimum runs to keep for each workflow'
11+
required: true
12+
default: '6'
13+
delete_workflow_pattern:
14+
description: 'Name or filename of the workflow (if not set, all workflows are targeted)'
15+
required: false
16+
delete_workflow_by_state_pattern:
17+
description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
18+
required: true
19+
default: "ALL"
20+
type: choice
21+
options:
22+
- "ALL"
23+
- active
24+
- deleted
25+
- disabled_inactivity
26+
- disabled_manually
27+
delete_run_by_conclusion_pattern:
28+
description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success'
29+
required: true
30+
default: "failure"
31+
type: choice
32+
options:
33+
- "ALL"
34+
- "Unsuccessful: action_required,cancelled,failure,skipped"
35+
- action_required
36+
- cancelled
37+
- failure
38+
- skipped
39+
- success
40+
dry_run:
41+
description: 'Logs simulated changes, no deletions are performed'
42+
required: false
43+
44+
jobs:
45+
del_runs:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
actions: write
49+
steps:
50+
- name: Delete workflow runs
51+
uses: Mattraks/delete-workflow-runs@v2
52+
with:
53+
token: ${{ github.token }}
54+
repository: ${{ github.repository }}
55+
retain_days: ${{ github.event.inputs.days }}
56+
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
57+
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
58+
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
59+
delete_run_by_conclusion_pattern: >-
60+
${{
61+
startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:')
62+
&& 'action_required,cancelled,failure,skipped'
63+
|| github.event.inputs.delete_run_by_conclusion_pattern
64+
}}
65+
dry_run: ${{ github.event.inputs.dry_run }}

.github/workflows/qmake.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ on:
44
# push代码时触发workflow
55
push:
66
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
7+
- '.github/workflows/clean_cache.yml'
8+
- '.github/workflows/delete_workflow.yml'
9+
- '.github/workflows/cmake.yml'
10+
- '.github/workflows/readme.yml'
11+
- '.github/workflows/toolchain.yml'
712
- 'doc/**'
813
- '.clang-*'
914
- '.gitignore'
1015
- 'LICENSE'
1116
- 'README*'
1217
pull_request:
1318
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
19+
- '.github/workflows/clean_cache.yml'
20+
- '.github/workflows/delete_workflow.yml'
21+
- '.github/workflows/cmake.yml'
22+
- '.github/workflows/readme.yml'
23+
- '.github/workflows/toolchain.yml'
1424
- 'doc/**'
1525
- '.clang-*'
1626
- '.gitignore'
@@ -29,19 +39,22 @@ jobs:
2939
- macos-latest
3040
- ubuntu-latest
3141
qt_ver:
32-
- 6.5.2
42+
- 6.6.1
3343

3444
steps:
35-
- name: cache vcpkg
36-
uses: actions/cache@v3
37-
with:
38-
path: |
39-
C:\vcpkg\installed
40-
/usr/local/share/vcpkg/installed
41-
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ github.sha }}
42-
restore-keys: |
43-
${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
44-
${{ runner.os }}-vcpkg-installed-
45+
- name: Restore windows vcpkg
46+
if: startsWith(matrix.os, 'windows')
47+
uses: actions/cache/restore@v3
48+
with:
49+
path: C:\vcpkg\installed
50+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
51+
- name: Restore macos or ubuntu vcpkg
52+
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
53+
uses: actions/cache/restore@v3
54+
with:
55+
path: /usr/local/share/vcpkg/installed
56+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
57+
4558
- name: Install dependencies on windows
4659
if: startsWith(matrix.os, 'windows')
4760
shell: bash
@@ -75,10 +88,10 @@ jobs:
7588
with:
7689
version: ${{ matrix.qt_ver }}
7790
install-deps: 'true'
78-
modules: 'qt5compat addons.qtserialport addons.qtnetworkauth addons.qtmultimedia addons.qtimageformats'
91+
modules: 'qt5compat qtserialport qtnetworkauth qtmultimedia qtimageformats'
7992
cache: 'true'
8093

81-
- uses: actions/checkout@v3
94+
- uses: actions/checkout@v4
8295
with:
8396
fetch-depth: 1
8497

.github/workflows/readme.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Setup Node.js
17-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: 12.x
2020
# ISO Langusge Codes: https://cloud.google.com/translate/docs/languages

.github/workflows/toolchain.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build toolchain
2+
3+
on:
4+
# 清理 Cache 后触发
5+
workflow_run:
6+
workflows: [Cleanup caches by a branch]
7+
types: completed
8+
# 手动触发
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os:
19+
- windows-latest
20+
- windows-2019
21+
- macos-latest
22+
- ubuntu-latest
23+
qt_ver:
24+
- 6.6.1
25+
26+
steps:
27+
- name: Install Qt
28+
uses: jurplel/install-qt-action@v3
29+
with:
30+
version: ${{ matrix.qt_ver }}
31+
install-deps: 'true'
32+
modules: 'qt5compat qtserialport qtnetworkauth qtmultimedia qtimageformats'
33+
cache: 'true'
34+
35+
- name: Install dependencies on windows
36+
if: startsWith(matrix.os, 'windows')
37+
shell: bash
38+
run: |
39+
choco install ninja
40+
ninja --version
41+
cmake --version
42+
vcpkg install breakpad --triplet x64-windows
43+
- name: Install dependencies on macos
44+
if: startsWith(matrix.os, 'macos')
45+
shell: bash
46+
run: |
47+
brew install ninja nasm pkg-config
48+
ninja --version
49+
cmake --version
50+
clang --version
51+
vcpkg install breakpad --triplet x64-osx
52+
- name: Install dependencies on ubuntu
53+
if: startsWith(matrix.os, 'ubuntu')
54+
shell: bash
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install ninja-build nasm build-essential libgl1-mesa-dev
58+
ninja --version
59+
cmake --version
60+
gcc --version
61+
vcpkg install breakpad --triplet x64-linux
62+
63+
- name: cache windows vcpkg
64+
if: startsWith(matrix.os, 'windows')
65+
uses: actions/cache/save@v3
66+
with:
67+
path: C:\vcpkg\installed
68+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
69+
- name: cache macos or ubuntu vcpkg
70+
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
71+
uses: actions/cache/save@v3
72+
with:
73+
path: /usr/local/share/vcpkg/installed
74+
key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}
75+

0 commit comments

Comments
 (0)