diff options
Diffstat (limited to '.github/workflows/windows.yml')
| -rw-r--r-- | .github/workflows/windows.yml | 225 |
1 files changed, 116 insertions, 109 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index db2235eb6c..03e75ad445 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -3,19 +3,14 @@ on: push: paths-ignore: - 'doc/**' - - '**/man' + - '**/man/*' - '**.md' - '**.rdoc' - '**/.document' - '.*.yml' pull_request: - paths-ignore: - - 'doc/**' - - '**/man' - - '**.md' - - '**.rdoc' - - '**/.document' - - '.*.yml' + # Do not use paths-ignore for required status checks + # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks merge_group: concurrency: @@ -30,127 +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, 'Documentation') || contains(github.event.pull_request.title, '[DOC]') - || contains(github.event.pull_request.title, 'Documentation') || contains(github.event.pull_request.labels.*.name, 'Documentation') - || (github.event_name == 'push' && github.actor == 'dependabot[bot]') + || (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 }} - # FIXME: This is a workaround for the vcpkg's issue present as of openssl 3.1.1 - # where OpenSSL's default modules directory is incorrectly set to C:\vcpkg\packages\openssl_x64-windows\bin - # cf. https://github.com/ruby/openssl/pull/635#issuecomment-1596833720 - OPENSSL_MODULES: C:\vcpkg\installed\x64-windows\bin + 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 - with: - update: true - install: >- - ${{ steps.find-tools.outputs.needs }} - if: ${{ steps.find-tools.outputs.needs != '' }} - - - uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899 # v1.173.0 + - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.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 - - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - path: C:\vcpkg\downloads - key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}- - ${{ runner.os }}-vcpkg-download- + persist-credentials: false + sparse-checkout-cone-mode: false + sparse-checkout: /.github - - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + - uses: ./.github/actions/setup/directories with: - path: C:\vcpkg\installed - key: ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-vcpkg-installed-${{ env.OS_VER }}- - ${{ runner.os }}-vcpkg-installed- - - - name: Install libraries with vcpkg - run: | - vcpkg --triplet x64-windows install libffi libyaml openssl readline zlib + 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@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - 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 @@ -158,24 +148,18 @@ jobs: - name: compiler version run: cl - - name: link libraries - run: | - for %%I in (C:\vcpkg\installed\x64-windows\bin\*.dll) do ( - if not %%~nI == readline mklink %%~nxI %%I - ) - # We use OpenSSL instealled by vcpkg instead - - name: disable system OpenSSL - run: | - for %%I in (libcrypto-1_1-x64 libssl-1_1-x64) do ( - ren c:\Windows\System32\%%I.dll %%I.dll_ - ) - # windows-2019 image doesn't have OpenSSL as of 2023/9/14 - if: ${{ matrix.vs != 2019 }} + - 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=C:/vcpkg/installed/x64-windows + --with-opt-dir=%RUBY_OPT_DIR% + --with-gmp + + - run: nmake prepare-vcpkg - run: nmake incs @@ -185,25 +169,48 @@ jobs: # But not for this Visual Studio workflow. So here we extract gems before building. - run: nmake extract-gems - - run: nmake + # 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 - timeout-minutes: 5 + - run: nmake - - run: nmake test-spec - timeout-minutes: 10 + - name: Set up Launchable + uses: ./.github/actions/launchable/setup + with: + 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-2025-vs2026 + needs: [make] + steps: + - run: exit 1 + working-directory: + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + defaults: run: working-directory: build |
