From 81e78834d055919564c120eccf3251015660f31d Mon Sep 17 00:00:00 2001 From: JessGuo Date: Sun, 2 Apr 2023 23:36:23 +0800 Subject: [PATCH] update workflow, speed up ci --- .github/workflows/macos.yml | 17 ++++++++--------- .github/workflows/ubuntu.yml | 10 +++++++++- .github/workflows/windows.yml | 8 +++++++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 21a6104..081ebbb 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,24 +16,23 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-11.0] + os: [macos-12] qt_ver: [6.4.3] qt_arch: [clang_64] env: targetName: example steps: - # macos 11.0 默认环境变了,要指定 - - name: prepare env - if: ${{ matrix.os == 'macos-11.0' }} - run: | - softwareupdate --all --install --force - sudo xcode-select --print-path - sudo xcode-select --switch /Library/Developer/CommandLineTools + - name: '⚙️ Cache Qt' + id: cache-qt + uses: actions/cache@v3 + with: + path: ${{ runner.workspace }}/Qt + key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }} - name: Install Qt uses: jurplel/install-qt-action@v3 with: version: ${{ matrix.qt_ver }} - cached: 'false' + cache: ${{steps.cache-qt.outputs.cache-hit}} arch: ${{ matrix.qt_arch }} modules: 'qt5compat qtmultimedia qtshadertools qtimageformats' - uses: actions/checkout@v2 diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index d7831cc..8d38569 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -24,11 +24,17 @@ jobs: env: targetName: example steps: + - name: '⚙️ Cache Qt' + id: cache-qt + uses: actions/cache@v3 + with: + path: ${{ runner.workspace }}/Qt + key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }} - name: Install Qt uses: jurplel/install-qt-action@v3 with: version: ${{ matrix.qt_ver }} - cached: 'false' + cache: ${{steps.cache-qt.outputs.cache-hit}} arch: ${{ matrix.qt_arch }} modules: 'qt5compat qtmultimedia qtshadertools qtimageformats' - name: ubuntu install GL library @@ -44,6 +50,8 @@ jobs: uses: miurahr/install-linuxdeploy-action@v1 with: plugins: qt appimage + - name: Check if svg file exists + run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi # 打包 - name: package run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5577d6b..0dfa2c8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -30,6 +30,12 @@ jobs: fileName: example # 步骤 steps: + - name: '⚙️ Cache Qt' + id: cache-qt + uses: actions/cache@v3 + with: + path: ${{ runner.workspace }}\Qt + key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }} # 安装Qt - name: Install Qt # 使用外部action。这个action专门用来安装Qt @@ -37,7 +43,7 @@ jobs: with: version: ${{ matrix.qt_ver }} arch: ${{ matrix.qt_arch }} - cached: 'false' + cache: ${{steps.cache-qt.outputs.cache-hit}} modules: 'qt5compat qtmultimedia qtshadertools qtimageformats' # 拉取代码 - uses: actions/checkout@v2