diff options
Diffstat (limited to '.github/workflows/windows.yml')
| -rw-r--r-- | .github/workflows/windows.yml | 184 |
1 files changed, 96 insertions, 88 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 190710d745..03e75ad445 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,111 +25,122 @@ jobs: strategy: matrix: include: - - vc: 2015 - vs: 2019 - vcvars: '10.0.14393.0 -vcvars_ver=14.0' # The oldest Windows 10 SDK w/ VC++ 2015 toolset (v140) - - vs: 2019 - - vs: 2022 + - os: 2022 + test_task: check + - os: 2022 + test_task: test-bundled-gems + - os: 2025-vs2026 + test_task: check + - os: 2025-vs2026 + test_task: test-bundled-gems + - os: 11-arm + test_task: 'btest test-basic test-tool' # check and test-spec are broken yet. + target: arm64 fail-fast: false - runs-on: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }} + runs-on: windows-${{ matrix.os }} if: >- ${{!(false || contains(github.event.head_commit.message, '[DOC]') - || contains(github.event.head_commit.message, 'Document') || contains(github.event.pull_request.title, '[DOC]') - || contains(github.event.pull_request.title, 'Document') - || contains(github.event.pull_request.labels.*.name, 'Document') - || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]') + || contains(github.event.pull_request.labels.*.name, 'Documentation') + || (github.event.pull_request.user.login == 'dependabot[bot]' && !startsWith(github.head_ref, 'dependabot/vcpkg')) )}} - name: VisualStudio ${{ matrix.vc || matrix.vs }} + name: Windows ${{ matrix.os }} (${{ matrix.test_task }}) env: GITPULLOPTIONS: --no-tags origin ${{ github.ref }} - OS_VER: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }} VCPKG_DEFAULT_TRIPLET: ${{ matrix.target || 'x64' }}-windows steps: - run: md build working-directory: - - name: find tools - id: find-tools - run: | - ::- find needed tools - set NEEDS= - for %%I in (%NEEDED_TOOLS%) do if "%%~$PATH:I" == "" ( - call set NEEDS=%%NEEDS%% %%~nI - ) else ( - echo %%I: %%~$PATH:I - ) - echo.needs=%NEEDS%>>%GITHUB_OUTPUT% - if "%NEEDS%" == "" ( - echo [debug] All needed tools found - ) else ( - echo [warning^]Needs%NEEDS% - ) - env: - NEEDED_TOOLS: >- - patch.exe - - - uses: msys2/setup-msys2@d40200dc2db4c351366b048a9565ad82919e1c24 # v2 - id: setup-msys2 + - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0 with: - update: true - install: >- - ${{ steps.find-tools.outputs.needs }} - if: ${{ steps.find-tools.outputs.needs != '' }} - - - uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0 - with: - ruby-version: '3.0' + # windows-11-arm has only 3.4.1, 3.4.2, 3.4.3, head + ruby-version: ${{ !endsWith(matrix.os, 'arm') && '3.1' || '3.4' }} bundler: none windows-toolchain: none - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: /.github + + - uses: ./.github/actions/setup/directories with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + srcdir: src + builddir: build + make-command: nmake + clean: true - - name: Install libraries with scoop + - name: Install tools with scoop run: | - iex "& {$(irm get.scoop.sh)} -RunAsAdmin" + if ((vcpkg.exe help install) -match "manifest") { exit } + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + iwr -useb get.scoop.sh | iex Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH + scoop install vcpkg shell: pwsh - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Restore vcpkg artifact + id: restore-vcpkg + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - sparse-checkout-cone-mode: false - sparse-checkout: /.github + path: src\vcpkg_installed + key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }} - - uses: ./.github/actions/setup/directories + - name: Install libraries with vcpkg + id: build-vcpkg + run: | + git -C "%VCPKG_INSTALLATION_ROOT%" pull --quiet + vcpkg install + working-directory: src + if: ${{ ! steps.restore-vcpkg.outputs.cache-hit }} + + - name: Save vcpkg artifact + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - srcdir: src - builddir: build + path: src\vcpkg_installed + key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }} + if: >- + steps.build-vcpkg.outcome == 'success' && + ( github.ref_name == 'master' + || startsWith(github.ref_name, 'ruby_') + || ( github.event.pull_request.user.login == 'dependabot[bot]' + && startsWith(github.head_ref || github.ref_name, 'dependabot/vcpkg')) + ) - name: setup env # Available Ruby versions: https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#ruby # %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="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" - set | C:\msys64\usr\bin\sort > old.env - call %VCVARS% ${{ matrix.vcvars || '' }} + set > old.env + call ..\src\win32\vssetup.cmd ^ + -arch=${{ matrix.target || 'amd64' }} ^ + ${{ matrix.vcvars && '-vcvars_ver=' || '' }}${{ matrix.vcvars }} nmake -f nul - set TMP=%USERPROFILE%\AppData\Local\Temp - set TEMP=%USERPROFILE%\AppData\Local\Temp + set TMP=%RUNNER_TEMP% + set TEMP=%RUNNER_TEMP% set MAKEFLAGS=l set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul - set | C:\msys64\usr\bin\sort > new.env - C:\msys64\usr\bin\comm -13 old.env new.env >> %GITHUB_ENV% + set RUBY_OPT_DIR=%GITHUB_WORKSPACE:\=/%/src/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET% + set > new.env + + - name: update env + shell: pwsh + run: | + $old = (Get-Content old.env); $new = (Get-Content new.env) del *.env + Compare-Object $old $new | + Where-Object { $_.SideIndicator -eq '=>' } | + Select-Object -ExpandProperty InputObject | + Add-Content -Path $env:GITHUB_ENV - name: baseruby version run: ruby -v @@ -137,18 +148,16 @@ jobs: - name: compiler version run: cl - - name: Install libraries with vcpkg - run: | - vcpkg install - working-directory: src - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + - name: volume info + run: Get-Volume + shell: pwsh # TODO: We should use `../src` instead of `D:/a/ruby/ruby/src` - name: Configure run: >- ../src/win32/configure.bat --disable-install-doc - --with-opt-dir=D:/a/ruby/ruby/src/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET% + --with-opt-dir=%RUBY_OPT_DIR% + --with-gmp - run: nmake prepare-vcpkg @@ -160,43 +169,42 @@ jobs: # But not for this Visual Studio workflow. So here we extract gems before building. - run: nmake extract-gems - - run: nmake - - - run: nmake test - timeout-minutes: 5 + # windows-11-arm runner cannot run `ruby tool/file2lastrev.rb --revision.h --output=revision.h` + - name: make revision.h + run: | + win32\lastrev.bat | win32\ifchange.bat --timestamp=.revision.time revision.h - + type revision.h + working-directory: src - - run: nmake test-spec - timeout-minutes: 10 + - run: nmake - name: Set up Launchable uses: ./.github/actions/launchable/setup with: - os: windows-${{ matrix.vs < 2022 && '2019' || matrix.vs }} - test-task: test-all - # If we support a new test task, we need to change this test-opts. - test-opts: -j${{ env.TEST_JOBS || 4 }} --job-status=normal + os: windows-${{ matrix.os }} launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }} builddir: build srcdir: src + test-task: ${{ matrix.test_task || 'check' }} continue-on-error: true + if: ${{ matrix.test_task != 'test-bundled-gems' }} + timeout-minutes: 3 - - run: nmake test-all + - run: nmake ${{ matrix.test_task || 'check' }} env: - RUBY_TESTOPTS: >- - -j${{ env.TEST_JOBS || 4 }} - --job-status=normal - timeout-minutes: 60 + RUBY_TESTOPTS: -j${{ env.TEST_JOBS || 4 }} + timeout-minutes: 70 - uses: ./.github/actions/slack with: - label: VS${{ matrix.vc || matrix.vs }} / ${{ matrix.test_task || 'check' }} + label: Windows ${{ matrix.os }} / ${{ matrix.test_task || 'check' }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() }} result: if: ${{ always() }} name: ${{ github.workflow }} result - runs-on: windows-latest + runs-on: windows-2025-vs2026 needs: [make] steps: - run: exit 1 |
