ruby/.github/workflows/mingw.yml
2025-08-14 15:12:46 -07:00

221 lines
6.9 KiB
YAML

name: MinGW
on:
push:
paths-ignore:
- 'doc/**'
- '**/man/*'
- '**.md'
- '**.rdoc'
- '**/.document'
- '.*.yml'
pull_request:
paths-ignore:
- 'doc/**'
- '**/man/*'
- '**.md'
- '**.rdoc'
- '**/.document'
- '.*.yml'
merge_group:
concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
permissions:
contents: read
# Notes:
# Actions console encoding causes issues, see test-all & test-spec steps
#
jobs:
make:
runs-on: windows-2022
name: ${{ github.workflow }} (${{ matrix.msystem }})
env:
MSYSTEM: ${{ matrix.msystem }}
MSYS2_ARCH: x86_64
CHOST: 'x86_64-w64-mingw32'
CFLAGS: '-march=x86-64 -mtune=generic -O3 -pipe'
CXXFLAGS: '-march=x86-64 -mtune=generic -O3 -pipe'
CPPFLAGS: '-D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048'
LDFLAGS: '-pipe'
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
strategy:
matrix:
include:
# To mitigate flakiness of MinGW CI, we test only one runtime that newer MSYS2 uses.
# Ruby 3.2 is the first Windows Ruby to use OpenSSL 3.x
- msystem: 'UCRT64'
test_task: 'check'
test-all-opts: '--name=!/TestObjSpace#test_reachable_objects_during_iteration/'
fail-fast: false
if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
|| contains(github.event.pull_request.title, '[DOC]')
|| contains(github.event.pull_request.labels.*.name, 'Documentation')
|| (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}
steps:
- uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2.28.0
id: msys2
with:
msystem: UCRT64
update: true
install: >-
git
make
ruby
autoconf
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-ragel
mingw-w64-ucrt-x86_64-openssl
mingw-w64-ucrt-x86_64-libyaml
mingw-w64-ucrt-x86_64-libffi
- name: Set up env
id: setup-env
working-directory:
run: |
$msys2 = ${env:MSYS2_LOCATION}
echo $msys2\usr\bin $msys2\ucrt64\bin |
Tee-Object ${env:GITHUB_PATH} -Append -Encoding utf-8
# Use the fast device for the temporary directory.
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
$tmp = ${env:RUNNER_TEMP}
echo HOME=$home TMP=$tmp TEMP=$tmp TMPDIR=$tmp |
Tee-Object ${env:GITHUB_ENV} -Append -Encoding utf-8
shell: pwsh # cmd.exe does not strip spaces before `|`.
env:
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
- name: Remove Strawberry Perl pkg-config
working-directory:
# `pkg-config.bat` included in Strawberry Perl is written in
# Perl and doesn't work when another msys2 `perl` precede its
# own `perl`.
#
# ```
# Can't find C:\Strawberry\perl\bin\pkg-config.bat on PATH, '.' not in PATH.
# ```
run: |
Get-Command pkg-config.bat | % { ren $_.path ($_.path + "~") }
shell: pwsh
- name: Misc system & package info
working-directory:
run: |
group() { echo ::group::$'\e[94;1m'"$*"$'\e[m'; }
endgroup() { echo ::endgroup::; }
group Path
cygpath -wa / . $(type -p cygpath bash sh)
endgroup
I() {
group $1
run Where type -pa $1 && { [ $# -eq 1 ] || run Version "$@"; } ||
failed+=($1)
endgroup
}
run() { local w m=$1; shift; w="$("$@")" && show "$m" && indent "$w"; }
indent() { [ -z "$1" ] || echo "$1" | /bin/sed '/^$/!s/^/ /'; }
show() { echo $'\e[96m'"$*"$'\e[m'; }
failed=()
I gcc.exe --version
I ragel.exe --version
I make.exe --version
I openssl.exe version
I libcrypto-3-x64.dll
I libssl-3-x64.dll
group Packages
pacman -Qs mingw-w64-ucrt-x86_64-* | /bin/sed -n "s,local/mingw-w64-ucrt-x86_64-,,p"
endgroup
[ ${#failed[@]} -eq 0 ]
shell: sh
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
- uses: ./.github/actions/setup/directories
with:
srcdir: src
builddir: build
makeup: true
# Set fetch-depth: 10 so that Launchable can receive commits information.
fetch-depth: 10
- name: configure
run: >
../src/configure --disable-install-doc --prefix=/.
--build=$CHOST --host=$CHOST --target=$CHOST
shell: sh
- name: make all
timeout-minutes: 30
run: make -j4
- name: make install
run: make DESTDIR=../install install-nodoc
- name: Set up Launchable
uses: ./.github/actions/launchable/setup
with:
os: windows-2022
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
builddir: build
srcdir: src
test-tasks: '["test", "test-all", "test-spec"]'
continue-on-error: true
timeout-minutes: 3
- name: test
timeout-minutes: 30
run: make test
env:
GNUMAKEFLAGS: ''
RUBY_TESTOPTS: '-v --tty=no'
if: ${{ matrix.test_task == 'check' || matrix.test_task == 'test' }}
- name: test-all
timeout-minutes: 45
run: |
make ${{ StartsWith(matrix.test_task, 'test/') && matrix.test_task || 'test-all' }}
env:
RUBY_TESTOPTS: >-
--retry --job-status=normal --show-skip --timeout-scale=1.5 -j4
${{ matrix.test-all-opts }}
${{ env.TESTS }}
BUNDLER_VERSION:
if: ${{ matrix.test_task == 'check' || matrix.test_task == 'test-all' || StartsWith(matrix.test_task, 'test/') }}
- name: test-spec
timeout-minutes: 10
run: |
make ${{ StartsWith(matrix.test_task, 'spec/') && matrix.test_task || 'test-spec' }}
if: ${{ matrix.test_task == 'check' || matrix.test_task == 'test-spec' || StartsWith(matrix.test_task, 'spec/') }}
- uses: ./src/.github/actions/slack
with:
label: ${{ matrix.msystem }} / ${{ matrix.test_task }}
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}
defaults:
run:
working-directory: build
shell: cmd