Skip to content

Commit

Permalink
CI: Installing with cache
Browse files Browse the repository at this point in the history
  • Loading branch information
XMuli committed Apr 1, 2022
1 parent f6659ae commit df85d45
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: Linux
on:
# push代码时触发workflow
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'buildToVS2019.bat'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'buildToVS2019.bat'
jobs:
build:
name: Build
# 运行平台
# 运行平台, ubuntu-latest 目前是 Ubuntu 20.04
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
runs-on: ${{ matrix.os }}
strategy:
matrix: # 矩阵配置
Expand All @@ -28,21 +26,39 @@ jobs:
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true

steps:
# - name: Cache Qt # 使用缓存安装Qt模块
# id: cache-qt
# uses: actions/cache@v1 # not v2! 参见 https://github.com/jurplel/install-qt-action
# with:
# path: ../Qt
# key: ${{ runner.os }}-QtCache

- name: Cache Qt # 使用缓存安装Qt模块
id: cache-qt
uses: actions/cache@v1 # not v2! 参见 https://github.com/jurplel/install-qt-action
with:
path: ../Qt
key: ${{ runner.os }}-QtCache

- name: setupQt
if: steps.cache-qt.outputs.cache-hit == 'true'
shell: pwsh
env:
QtPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}
QtPluginPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/plugins
Qml2ImportPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/qml
run: |
$Qt5_Dir="${{ env.QtPath }}"
$QT_PLUGIN_PATH="${{ env.QtPluginPath }}"
$QML2_IMPORT_PATH="${{ env.Qml2ImportPath }}"
echo "Qt5_Dir=$Qt5_Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "QT_PLUGIN_PATH=$QT_PLUGIN_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "QML2_IMPORT_PATH=$QML2_IMPORT_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "GITHUB_PATH=$Qt5_Dir/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Qt
# if: steps.WindowsCacheQt.outputs.cache-hit != 'true'
if: steps.cache-qt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
# cached: ${{ steps.cache-qt.outputs.cache-hit }}
set-env: true
cached: ${{ steps.cache-qt.outputs.cache-hit }} // 默认 'false'

- uses: actions/checkout@v2
with:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/LinuxDeb.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: LinuxDeb
on:
# push代码时触发workflow
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'buildToVS2019.bat'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'buildToVS2019.bat'
jobs:
build:
Expand All @@ -27,7 +24,6 @@ jobs:
targetName: PicShot
targetLowerName: picshot
targetOS: debian
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true

steps:
- uses: actions/checkout@v2
Expand All @@ -47,12 +43,12 @@ jobs:
run: |
$systemInfo="${{ env.targetOS }}-x64"
$productVersion="${{ github.ref }}".substring("refs/tags/v".length)
$productName="${{ env.targetName }}-$productVersion-beta-protable-$systemInfo"
# $productName="${{ env.targetName }}-$productVersion-beta-protable-$systemInfo"
$productDebName="${{ env.targetLowerName }}-$productVersion"
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "productDebName=$productDebName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# 安装一些包
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ name: MacOS
on:
push:
paths-ignore:
- '**'
- 'README.md'
pull_request:
paths-ignore:
- 'debian'
- 'README.md'
- 'LICENSE'
- 'buildToVS2019.bat'
jobs:
build:
name: Build
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Windows
on:
# push代码时触发workflow
push:
paths:
- 'CMakeLists.txt'
Expand Down Expand Up @@ -43,7 +42,7 @@ jobs:
key: ${{ runner.os }}-QtCache

- name: setupQt
if: steps.WindowsCacheQt.outputs.cache-hit != 'true'
if: steps.cache-qt.outputs.cache-hit == 'true'
shell: pwsh
env:
QtPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}
Expand Down

0 comments on commit df85d45

Please sign in to comment.