Skip to content

Commit

Permalink
github: 优化 build-win32 速度
Browse files Browse the repository at this point in the history
  • Loading branch information
xychen committed Jun 17, 2022
1 parent 96b64d8 commit ae675a3
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/actions/setup-mingw64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Setup MINGW64

inputs:
install:
description: 'Additional packages to install'
required: false

outputs:
shell:
description: 'Shell to be used by other steps'
value: msys2 {0}

runs:
using: composite
steps:
- run: |
echo '${{ inputs.install }}' | tr ' ' '\n' | sort > cache-key
date -u '+%Y%m' >> cache-key
shell: bash
- uses: actions/cache@v3
id: cache-mingw64
with:
path: D:\msys64
key: mingw64-${{ hashFiles('cache-key') }}
- if: steps.cache-mingw64.outputs.cache-hit != 'true'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
release: true
install: ${{ inputs.install }}
location: D:\
- if: steps.cache-mingw64.outputs.cache-hit == 'true'
run: |
echo 'D:/msys64/usr/bin' >> $GITHUB_PATH
echo 'MSYSTEM=MINGW64' >> $GITHUB_ENV
echo 'MSYS2_PATH_TYPE=minimal' >> $GITHUB_ENV
echo 'CHERE_INVOKING=1' >> $GITHUB_ENV
MSYS2_CMD=D:/msys64/usr/bin/msys2.cmd
printf '@echo off\r\n' >> $MSYS2_CMD
printf 'setlocal\r\n' >> $MSYS2_CMD
printf 'D:\\msys64\\usr\\bin\\bash.exe -leo pipefail %%*\r\n' >> $MSYS2_CMD
shell: bash
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Setup MSYS2
uses: msys2/setup-msys2@v2
- name: Setup MinGW-w64
id: setup-mingw64
uses: ./.github/actions/setup-mingw64
with:
msystem: MINGW64
release: false
install: >-
git
zip
Expand All @@ -116,7 +115,7 @@ jobs:
uses: ./.github/actions/cmake-build
with:
run-tests: true
shell: msys2 {0}
shell: ${{ steps.setup-mingw64.outputs.shell }}

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand All @@ -129,7 +128,7 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/actions/release-zip
with:
shell: msys2 {0}
shell: ${{ steps.setup-mingw64.outputs.shell }}
name: cskburn-${{ matrix.name }}.zip
root-dir: build/cskburn
files: cskburn.exe
Expand Down

0 comments on commit ae675a3

Please sign in to comment.