diff options
Diffstat (limited to '.github/workflows/windows.yml')
| -rw-r--r-- | .github/workflows/windows.yml | 153 |
1 files changed, 76 insertions, 77 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 21f23ab899..03e75ad445 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,110 +25,122 @@ jobs: strategy: matrix: include: - - os: 2019 - vc: 2015 - vcvars: '10.0.14393.0 -vcvars_ver=14.0' # The oldest Windows 10 SDK w/ VC++ 2015 toolset (v140) - test_task: check - - os: 2019 - vc: 2019 - test_task: check - os: 2022 - vc: 2019 - vcvars: '10.0.22621.0 -vcvars_ver=14.2' # The defautl Windows 11 SDK and toolset are broken at windows-2022 test_task: check - - os: 2025 - vc: 2019 - vcvars: '10.0.22621.0 -vcvars_ver=14.2' + - 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 - - os: 2022 - vc: 2019 - vcvars: '10.0.22621.0 -vcvars_ver=14.2' - test_task: test-bundled-gems fail-fast: false - runs-on: windows-${{ matrix.os < 2022 && '2019' || matrix.os }} + 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, 'Documentation') - || (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]') + || (github.event.pull_request.user.login == 'dependabot[bot]' && !startsWith(github.head_ref, 'dependabot/vcpkg')) )}} - name: Windows ${{ matrix.os }}/Visual C++ ${{ matrix.vc }} (${{ matrix.test_task }}) + name: Windows ${{ matrix.os }} (${{ matrix.test_task }}) env: GITPULLOPTIONS: --no-tags origin ${{ github.ref }} - OS_VER: windows-${{ matrix.os < 2022 && '2019' || matrix.os }} VCPKG_DEFAULT_TRIPLET: ${{ matrix.target || 'x64' }}-windows - RUBY_OPT_DIR: ${{ matrix.os == '11-arm' && 'C' || 'D' }}:/a/ruby/ruby/src/vcpkg_installed/%VCPKG_DEFAULT_TRIPLET% steps: - run: md build working-directory: - - uses: ruby/setup-ruby@d8d83c3960843afb664e821fed6be52f37da5267 # v1.231.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 - if: ${{ matrix.os != '11-arm' }} - - name: Install libraries with scoop + - 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: + srcdir: src + builddir: build + make-command: nmake + clean: true + + - name: Install tools with scoop run: | + 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 uutils-coreutils cmake@3.31.6 + scoop install vcpkg shell: pwsh - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 + - name: Restore vcpkg artifact + id: restore-vcpkg + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + path: src\vcpkg_installed + key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }} - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - sparse-checkout-cone-mode: false - sparse-checkout: /.github + - 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 }} - - uses: ./.github/actions/setup/directories + - 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 up VC ${{ matrix.vc }} - set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" - for /f "delims=;" %%I in ('%vswhere% -latest -property installationPath') do ( - set VCVARS="%%I\VC\Auxiliary\Build\vcvars64.bat" - ) - if "${{ matrix.os }}" == "11-arm" ( - set VCVARS="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat" - ) - set VCVARS - set | uutils 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 | uutils sort > new.env - uutils 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 @@ -140,13 +152,6 @@ jobs: run: Get-Volume shell: pwsh - - name: Install libraries with vcpkg - run: | - vcpkg install - working-directory: src - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - # TODO: We should use `../src` instead of `D:/a/ruby/ruby/src` - name: Configure run: >- @@ -165,31 +170,25 @@ jobs: - run: nmake extract-gems # windows-11-arm runner cannot run `ruby tool/file2lastrev.rb --revision.h --output=revision.h` - - run: | - Set-Content -Path "revision.h" -Value @" - #define RUBY_REVISION "8aedb979da" - #define RUBY_FULL_REVISION "8aedb979da4090116f4fc5a6497f139fd0038881" - #define RUBY_BRANCH_NAME "win-arm" - #define RUBY_RELEASE_DATETIME "2025-04-16T23:18:54Z" - #define RUBY_RELEASE_YEAR 2025 - #define RUBY_RELEASE_MONTH 4 - #define RUBY_RELEASE_DAY 17 - "@ - shell: pwsh - if: ${{ matrix.os == '11-arm' }} + - name: make revision.h + run: | + win32\lastrev.bat | win32\ifchange.bat --timestamp=.revision.time revision.h - + type revision.h + working-directory: src - run: nmake - name: Set up Launchable uses: ./.github/actions/launchable/setup with: - os: windows-${{ matrix.os < 2022 && '2019' || matrix.os }} + 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 ${{ matrix.test_task || 'check' }} env: @@ -198,14 +197,14 @@ jobs: - uses: ./.github/actions/slack with: - label: Windows ${{ matrix.os }} / VC ${{ matrix.vc }} / ${{ 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 |
