[前][次][番号順一覧][スレッド一覧]

ruby-changes:71229

From: Nobuyoshi <ko1@a...>
Date: Sun, 20 Feb 2022 20:40:15 +0900 (JST)
Subject: [ruby-changes:71229] 71388f9d39 (master): [MSWin] Reduce duplicate configurations

https://git.ruby-lang.org/ruby.git/commit/?id=71388f9d39

From 71388f9d395cc9864e37a6767c7f59538f947b3d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 5 Dec 2021 16:32:04 +0900
Subject: [MSWin] Reduce duplicate configurations

---
 .github/workflows/windows.yml | 24 +++++++++++++-----------
 1 file 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: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L21
       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: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L39
           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: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L47
       - 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: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L64
       - 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: https://github.com/ruby/ruby/blob/trunk/.github/workflows/windows.yml#L91
         # %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
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]