1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
|
name: CI
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
push:
branches:
- master
tags:
- "*.*.*"
pull_request:
types: [opened, synchronize]
branches:
- "*"
permissions:
contents: read
jobs:
system-libffi:
# Run on latest MRI with explicit selection of system or builtin libffi
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-15-intel, windows-latest, windows-11-arm ]
extconfopts: [ --disable-system-libffi, --enable-system-libffi ]
extconfopts2: [ --disable-libffi-alloc, --enable-libffi-alloc ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
- if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install -y libltdl-dev
- if: matrix.os == 'macos-15-intel'
run: brew update && brew install automake libffi pkg-config
- if: matrix.os == 'windows-latest' && matrix.extconfopts == '--enable-system-libffi'
shell: cmd
run: ridk exec sh -c "pacman --sync --refresh --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-libffi"
- run: bundle install
- run: bundle exec rake libffi
- run: bundle exec rake compile -- ${{ matrix.extconfopts }} ${{ matrix.extconfopts2 }}
env:
# work around misconfiguration of libffi on MacOS with homebrew
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:/usr/local/opt/libffi/lib/pkgconfig
- run: bundle exec rake test FFI_TEST_GC=true
- run: bundle exec rake types_conf && git --no-pager diff
steep_check:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
ruby: [ 3.0, 3.1, 3.2, 3.3, 3.4, ruby-head ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: bundle install
- run: bundle exec steep check
specs:
# Run all specs on all ruby implementations
# Use automatic libffi selection on MRI
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-15-intel, windows-latest ]
ruby: [ "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "4.0", ruby-head, truffleruby-head, jruby-head ]
exclude:
- os: windows-latest
ruby: truffleruby-head
- os: windows-latest
ruby: "2.5"
include:
- os: windows-latest
ruby: ruby-mswin
- os: windows-11-arm
ruby: 3.4
- os: windows-11-arm
ruby: ruby-head
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# - uses: ruby/setup-ruby@v1 # workaround missing ruby-4.0 on Windows
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
with:
ruby-version: ${{ matrix.ruby }}
- if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install -y libltdl-dev
- run: brew install automake
if: matrix.os == 'macos-15-intel'
- run: bundle install
- run: bundle exec rake libffi
- run: bundle exec rake compile
- if: matrix.os == 'windows-latest' || matrix.os != 'windows-11-arm'
# force the use of GNU make.exe on MSWIN platform for building libtest.dll
run: bundle exec rake test MAKE=make
- if: matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm'
run: bundle exec rake test FFI_TEST_GC=true
- run: bundle exec rake bench:all MAKE=make
if: ${{ matrix.ruby != 'truffleruby-head' && matrix.ruby != 'jruby-head' }}
env:
ITER: 10
gc_stress:
if: github.ref == 'refs/heads/master'
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ ruby-head ]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: sudo apt update && sudo apt install -y libltdl-dev
- run: bundle install
- run: bundle exec rake libffi
- name: Play dice if we run the tests or don't
id: run_it
run: ruby -e "puts 'RUN_IT=true' if rand < 0.1" >> $GITHUB_OUTPUT
- name: Run all tests with GC.stress=true
if: steps.run_it.outputs.RUN_IT == 'true'
run: bundle exec rake compile test FFI_GC_STRESS=true
rcd_build:
name: build fat binary gems
strategy:
fail-fast: false
matrix:
platform:
- x86-mingw32
- x64-mingw-ucrt
- x64-mingw32
- x86-linux-gnu
- x86-linux-musl
- x86_64-linux-gnu
- x86_64-linux-musl
- x86_64-darwin
- arm64-darwin
- arm-linux-gnu
- arm-linux-musl
- aarch64-linux-gnu
- aarch64-linux-musl
- aarch64-mingw-ucrt
runs-on: ubuntu-latest
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
- name: Install libltdl-dev
run: sudo apt update && sudo apt install -y libltdl-dev
- name: Build ffi.gem
run: |
bundle install
bundle exec rake libffi
bundle exec rake gem:${PLATFORM}
- name: Upload binary gem
uses: actions/upload-artifact@v4
with:
name: gem-${{ matrix.platform }}
path: pkg/*-*-*.gem
job_test_native:
name: native test
needs: rcd_build
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- macos-15-intel
- macos-latest
- ubuntu-latest
ruby:
- "4.0"
- "3.4"
- "3.3"
- "3.2"
- "3.1"
- "3.0"
include:
- os: windows-latest
platform: x64-mingw32
- os: macos-15-intel
platform: x86_64-darwin
- os: macos-latest
platform: arm64-darwin
- os: ubuntu-latest
platform: x86_64-linux-gnu
- os: windows-latest
ruby: "3.1"
platform: x64-mingw-ucrt
- os: windows-latest
ruby: "3.2"
platform: x64-mingw-ucrt
- os: windows-latest
ruby: "3.3"
platform: x64-mingw-ucrt
- os: windows-latest
ruby: "3.4"
platform: x64-mingw-ucrt
- os: windows-latest
ruby: "4.0"
platform: x64-mingw-ucrt
- os: windows-11-arm
ruby: "3.4"
platform: aarch64-mingw-ucrt
- os: windows-11-arm
ruby: "4.0"
platform: aarch64-mingw-ucrt
exclude:
- os: windows-latest
ruby: "3.1"
- os: windows-latest
ruby: "3.2"
- os: windows-latest
ruby: "3.3"
- os: windows-latest
ruby: "3.4"
- os: windows-latest
ruby: "4.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# - uses: ruby/setup-ruby@v1 # workaround missing ruby-4.0 on Windows
- uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby --version
- name: Download gem-${{matrix.platform}}
uses: actions/download-artifact@v4
with:
name: gem-${{ matrix.platform }}
- name: Update rubygems - ruby-3.0
if: matrix.ruby == '3.0'
run: |
gem install --no-doc rubygems-update -v 3.5.7
update_rubygems
- if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install -y libltdl-dev
- name: Install gem-${{matrix.platform}}
run: gem install --local *.gem --verbose
- name: Run tests
run: |
bundle install
ruby -rffi -S rake test
job_fat_binary_multiarch:
name: multiarch (${{matrix.platform}} on ${{matrix.from_image}} ${{matrix.image_platform}})
needs: rcd_build
strategy:
fail-fast: false
matrix:
include:
- from_image: ghcr.io/dtcooper/raspberrypi-os:latest
runon: ubuntu-24.04-arm
image_platform: linux/arm/v7
gem_platform: arm-linux-gnu
dockerfile: debian
- from_image: ubuntu
runon: ubuntu-24.04-arm
image_platform: linux/arm64/v8
gem_platform: aarch64-linux-gnu
dockerfile: debian
- from_image: alpine
runon: ubuntu-latest
image_platform: linux/386
gem_platform: x86-linux-musl
dockerfile: alpine
- from_image: alpine
runon: ubuntu-24.04-arm
image_platform: linux/arm/v6
gem_platform: arm-linux-musl
dockerfile: alpine
runs-on: ${{matrix.runon}}
steps:
- uses: actions/checkout@v4
- name: Download gem-${{matrix.gem_platform}}
uses: actions/download-artifact@v4
with:
name: gem-${{ matrix.gem_platform }}
- name: Build image and Run tests
run: |
docker build --rm --platform ${{matrix.image_platform}} --build-arg from_image=${{matrix.from_image}} -t ruby-test -f spec/env/Dockerfile.${{matrix.dockerfile}} .
docker run --rm -t --network=host -v `pwd`:/build ruby-test
|