1818 SNAPSHOT_SLACK_WEBHOOK_URL :
1919 required : false
2020
21- permissions :
22- contents : read
21+ # GITHUB_TOKEN permissions are inherited from the caller job. Declaring
22+ # permissions here would be an elevation request and fail at startup when
23+ # the caller's token is capped to read-only (fork pull requests).
2324
2425jobs :
2526 windows :
4142 GITPULLOPTIONS : --no-tags origin ${{github.ref}}
4243 PATCH : C:\msys64\usr\bin\patch.exe
4344 OS_VER : windows-${{ matrix.os }}
44- # see https://github.com/ruby/ruby/commit/9ff4399decef0036897d3cfb9ac2c710dea913ca
45- OPENSSL_MODULES : C:\vcpkg\installed\x64-windows\bin
45+ VCPKG_DEFAULT_TRIPLET : x64-windows
46+ FEED_URL : https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
4647 steps :
4748 - run : md build
4849 working-directory :
6364 shell : msys2 {0}
6465 run : echo PATCH=$(cygpath -wa $(command -v patch)) >> $GITHUB_ENV
6566 if : ${{ steps.setup-msys2.outcome == 'success' }}
66- - uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
67- with :
68- path : C:\vcpkg\installed
69- key : ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}-${{ github.sha }}
70- restore-keys : |
71- ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}-
72- ${{ runner.os }}-vcpkg-installed-
73- - name : Install libraries with vcpkg
74- run : |
75- vcpkg --triplet x64-windows install gmp libffi libyaml openssl zlib
76-
7767 - uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7868 with :
7969 name : Packages
8272 run : 7z x pkg/*.zip
8373 working-directory :
8474
75+ - name : Set up vcpkg binary cache
76+ shell : pwsh
77+ env :
78+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
79+ FEED_OWNER : ${{ github.repository_owner }}
80+ # The github context of a reusable workflow belongs to the caller;
81+ # the GITHUB_TOKEN of pull_request events (forks, dependabot) is
82+ # read-only. Packages are uploaded on push, merge_group, and
83+ # workflow_dispatch.
84+ FEED_MODE : ${{ github.event_name != 'pull_request' && 'readwrite' || 'read' }}
85+ run : |
86+ $nuget = (vcpkg fetch nuget) | Select-Object -Last 1
87+ & $nuget sources add -Source $Env:FEED_URL -StorePasswordInClearText `
88+ -Name GitHubPackages -UserName $Env:FEED_OWNER -Password $Env:GH_TOKEN
89+ & $nuget setapikey $Env:GH_TOKEN -Source $Env:FEED_URL
90+ "VCPKG_BINARY_SOURCES=clear;nuget,$Env:FEED_URL,$Env:FEED_MODE" >> $Env:GITHUB_ENV
91+
92+ - name : Install libraries with vcpkg
93+ run : |
94+ git -C "%VCPKG_INSTALLATION_ROOT%" pull --quiet
95+ vcpkg install
96+ working-directory : ${{ inputs.archname }}
97+
8598 - uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
8699 with :
87100 path : snapshot-*/.downloaded-cache
90103 - name : setup env
91104 # %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
92105 # https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
106+ # OPENSSL_MODULES: see https://github.com/ruby/ruby/commit/9ff4399decef0036897d3cfb9ac2c710dea913ca
93107 env :
94108 ARCHNAME : ${{ inputs.archname }}
95109 run : |
98112 set TMP=%USERPROFILE%\AppData\Local\Temp
99113 set TEMP=%USERPROFILE%\AppData\Local\Temp
100114 set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul
115+ set RUBY_OPT_DIR=%GITHUB_WORKSPACE:\=/%/%ARCHNAME%/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET%
116+ set OPENSSL_MODULES=%GITHUB_WORKSPACE%\%ARCHNAME%\vcpkg_installed\%VCPKG_DEFAULT_TRIPLET%\bin
101117 set > new.env
102118
103119 - name : update env
@@ -109,17 +125,13 @@ jobs:
109125 Where-Object { $_.SideIndicator -eq '=>' } |
110126 Select-Object -ExpandProperty InputObject |
111127 Add-Content -Path $env:GITHUB_ENV
112- - name : link libraries
113- run : |
114- for %%I in (C:\vcpkg\installed\x64-windows\bin\*.dll) do (
115- mklink %%~nxI %%I
116- )
117128 - name : Configure
118129 env :
119130 ARCHNAME : ${{ inputs.archname }}
120131 run : >-
121132 ../%ARCHNAME%/win32/configure.bat --disable-install-doc
122- --with-opt-dir=C:/vcpkg/installed/x64-windows
133+ --with-opt-dir=%RUBY_OPT_DIR%
134+ - run : nmake prepare-vcpkg
123135 - run : nmake incs
124136 - run : nmake extract-extlibs
125137 - run : nmake
0 commit comments