summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-12-05 16:32:04 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-20 20:39:48 +0900
commit71388f9d395cc9864e37a6767c7f59538f947b3d (patch)
treef933efa57b24a36c8b13b88ac0d47e443c1a349a /.github/workflows
parent74707800588dc452d5a64e786b5c98d0e7586e74 (diff)
[MSWin] Reduce duplicate configurations
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5579
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/windows.yml24
1 files changed, 13 insertions, 11 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 63e1c57e95..409c3ee176 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -21,19 +21,15 @@ jobs:
matrix:
include:
- vs: 2019
- os: windows-2019
- vcvars: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
# - vs: 2022
- # os: windows-2022
- # vcvars: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
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') }}
name: VisualStudio ${{ matrix.vs }}
env:
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
- VCVARS: ${{ matrix.vcvars }}
PATCH: C:\msys64\usr\bin\patch.exe
+ OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }}
steps:
- run: md build
working-directory:
@@ -43,7 +39,7 @@ jobs:
update: true
install: >-
patch
- if: ${{ matrix.os != 'windows-2019' }}
+ if: ${{ env.OS_VER != 'windows-2019' }}
- name: patch path
shell: msys2 {0}
run: echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV
@@ -51,9 +47,9 @@ jobs:
- uses: actions/cache@v2
with:
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: |
- ${{ runner.os }}-vcpkg-download-${{ matrix.os }}-
+ ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
${{ runner.os }}-vcpkg-download-
- uses: actions/cache@v2
with:
@@ -68,9 +64,9 @@ jobs:
- uses: actions/cache@v2
with:
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: |
- ${{ runner.os }}-chocolatey-${{ matrix.os }}-
+ ${{ runner.os }}-chocolatey-${{ env.OS_VER }}-
${{ runner.os }}-chocolatey-
- name: Install libraries with chocolatey
run: |
@@ -95,6 +91,12 @@ jobs:
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
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
call %VCVARS%
set TMP=%USERPROFILE%\AppData\Local\Temp