[MSWin] Reduce duplicate configurations

This commit is contained in:
Nobuyoshi Nakada 2021-12-05 16:32:04 +09:00
Родитель 7470780058
Коммит 71388f9d39
1 изменённых файлов: 13 добавлений и 11 удалений

24
.github/workflows/windows.yml поставляемый
Просмотреть файл

@ -21,19 +21,15 @@ jobs:
matrix: matrix:
include: include:
- vs: 2019 - vs: 2019
os: windows-2019
vcvars: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
# - vs: 2022 # - vs: 2022
# os: windows-2022
# vcvars: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
fail-fast: false fail-fast: false
runs-on: ${{ matrix.os }} runs-on: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
if: ${{ !startsWith(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} if: ${{ !startsWith(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }}
name: VisualStudio ${{ matrix.vs }} name: VisualStudio ${{ matrix.vs }}
env: env:
GITPULLOPTIONS: --no-tags origin ${{github.ref}} GITPULLOPTIONS: --no-tags origin ${{github.ref}}
VCVARS: ${{ matrix.vcvars }}
PATCH: C:\msys64\usr\bin\patch.exe PATCH: C:\msys64\usr\bin\patch.exe
OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
steps: steps:
- run: md build - run: md build
working-directory: working-directory:
@ -43,7 +39,7 @@ jobs:
update: true update: true
install: >- install: >-
patch patch
if: ${{ matrix.os != 'windows-2019' }} if: ${{ env.OS_VER != 'windows-2019' }}
- name: patch path - name: patch path
shell: msys2 {0} shell: msys2 {0}
run: echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV run: echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV
@ -51,9 +47,9 @@ jobs:
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: C:\vcpkg\downloads path: C:\vcpkg\downloads
key: ${{ runner.os }}-vcpkg-download-${{ matrix.os }}-${{ github.sha }} key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-vcpkg-download-${{ matrix.os }}- ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
${{ runner.os }}-vcpkg-download- ${{ runner.os }}-vcpkg-download-
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
@ -68,9 +64,9 @@ jobs:
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}-chocolatey-${{ matrix.os }}-${{ github.sha }} key: ${{ runner.os }}-chocolatey-${{ env.OS_VER }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-chocolatey-${{ matrix.os }}- ${{ runner.os }}-chocolatey-${{ env.OS_VER }}-
${{ runner.os }}-chocolatey- ${{ runner.os }}-chocolatey-
- name: Install libraries with chocolatey - name: Install libraries with chocolatey
run: | run: |
@ -95,6 +91,12 @@ jobs:
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent. # %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302 # https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
run: | run: |
set VS=${{ matrix.vs }}
set VCVARS=${{ matrix.vcvars }}
if not "%VCVARS%" == "" goto :vcset
set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
:vcset
set | C:\msys64\usr\bin\sort > old.env set | C:\msys64\usr\bin\sort > old.env
call %VCVARS% call %VCVARS%
set TMP=%USERPROFILE%\AppData\Local\Temp set TMP=%USERPROFILE%\AppData\Local\Temp