Skip to content

Invoke POSTLINK script in mkmf to support codesign on macos #1667

Invoke POSTLINK script in mkmf to support codesign on macos

Invoke POSTLINK script in mkmf to support codesign on macos #1667

Workflow file for this run

---
name: "CI"
on:
push:
branches:
- main
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
DEBUG_OUTPUT_DIR: /tmp/debug
jobs:
fetch_ci_data:
name: πŸ“₯ Fetch CI data
runs-on: ubuntu-latest
outputs:
minimum-supported-ruby-version: ${{ steps.data.outputs.minimum-supported-ruby-version }}
minimum-supported-rust-version: ${{ steps.data.outputs.minimum-supported-rust-version }}
steps:
- id: data
run: |
curl -s https://raw.githubusercontent.com/oxidize-rb/rb-sys/$GITHUB_SHA/data/toolchains.json > toolchains.json
echo "minimum-supported-rust-version=$(jq -r '.policy["minimum-supported-rust-version"]' toolchains.json)" >> $GITHUB_OUTPUT
build_and_test:
name: πŸ§ͺ Test
needs: fetch_ci_data
strategy:
fail-fast: false
matrix:
# Test against all versions supported by rubygems
ruby_version: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
sys:
- os: ubuntu-latest
rust_toolchain: ${{ needs.fetch_ci_data.outputs.minimum-supported-rust-version }}
- os: ubuntu-latest
rust_toolchain: stable
- os: macos-latest
rust_toolchain: stable
- os: windows-2022
rust_toolchain: stable
exclude:
# Missing symbols for some reason, need to fix
- ruby_version: "2.6"
sys:
os: macos-latest
rust_toolchain: stable
- ruby_version: "2.7"
sys:
os: macos-latest
rust_toolchain: stable
- ruby_version: "3.1"
sys:
os: macos-latest
rust_toolchain: stable
# MSC version mismatch, need to fix
# include:
# - ruby_version: mswin
# sys:
# os: windows-2022
# rust_toolchain: stable-x86_64-pc-windows-msvc
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/upload-core-dumps@v1
- name: Setup debug info
shell: bash
run: script/ci/set-debug-env.sh
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
if: matrix.ruby_version != 'skip'
with:
cache-version: v2
ruby-version: ${{ matrix.ruby_version }}
rustup-toolchain: ${{ matrix.sys.rust_toolchain }}
bundler-cache: true
cargo-cache: true
- name: Bundle install
if: matrix.ruby_version == 'skip'
shell: bash
run: bundle install -j3
- name: Debug makefile
if: env.ACTIONS_STEP_DEBUG == 'true'
shell: bash
run: |
bundle exec rake debug:mkmf > $DEBUG_OUTPUT_DIR/Makefile
echo "::group::Print mkmf generated Makefile"
cat $DEBUG_OUTPUT_DIR/Makefile
echo "::endgroup::"
- name: πŸ“ Examples test
shell: bash
env:
RB_SYS_CARGO_PROFILE: "release"
run: |
ulimit -c unlimited
script/ci/upload-on-failure.sh "bundle exec rake test:examples" "examples-test" "./examples"
- name: πŸ§ͺ Cargo test
shell: bash
if: matrix.ruby_version != 'mswin'
run: |
ulimit -c unlimited
bundle exec rake test:cargo
- name: πŸ’Ž Gem test
run: bundle exec rake test:gem
- name: πŸ’¨ Smoke test
shell: bash
run: |
set -ex
ulimit -c unlimited
gem update --system 3.3.22 > /dev/null
export RUBYOPT="-I$PWD/gem/lib"
pushd examples/rust_reverse
bundle exec rake build
gem install pkg/*.gem --verbose
../../script/ci/upload-on-failure.sh "gem install pkg/*.gem --verbose" "smoke-test" "./pkg"
ruby -rrust_reverse -e "puts RustReverse.reverse('olleh')" | grep hello
popd
- name: βœ‚οΈ Run clippy
run: cargo clippy
- name: πŸ“ƒ Run cargo fmt
if: matrix.sys.rust_toolchain == 'stable'
run: cargo fmt --check
- name: πŸš“ Run Standard.rb
if: matrix.ruby_version == '3.1'
run: bundle exec standardrb --format github
- name: "🧱 Generate bindings"
if: env.ACTIONS_STEP_DEBUG == 'true'
run: bundle exec rake bindings:generate
- uses: actions/upload-artifact@v4
if: always()
with:
name: rb-sys-ci-debug-artifacts-${{ matrix.sys.os }}-${{ matrix.ruby_version }}
if-no-files-found: ignore
retention-days: 1
path: |
/tmp/bindings/**/*
${{ env.DEBUG_OUTPUT_DIR }}/**/*
build_and_test_static:
name: πŸ”˜ Static
strategy:
fail-fast: false
matrix:
ruby_version: ["3.2.2"]
sys:
- os: ubuntu-latest
rust_toolchain: stable
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/upload-core-dumps@v1
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: none
rustup-toolchain: ${{ matrix.sys.rust_toolchain }}
cargo-cache: "sccache"
- name: Setup env
run: |
echo "PATH=/opt/rubies/${{ matrix.ruby_version }}/bin:$PATH" >> $GITHUB_ENV
echo "GEM_HOME=~/.gem/ruby/${{ matrix.ruby_version }}" >> $GITHUB_ENV
- name: ⚑ Cache
uses: actions/cache@v4
with:
path: |
/opt/rubies/${{ matrix.ruby_version }}
~/.gem/ruby/${{ matrix.ruby_version }}
key: rb-sys-ruby-static-${{ matrix.sys.os }}-${{ matrix.ruby_version }}
- name: πŸ”˜ Build static ruby
working-directory: /tmp
run: |
if [ -d /opt/rubies/${{matrix.ruby_version }} ]; then
echo "Ruby ${{ matrix.ruby_version }} already installed, skipping build"
else
git clone https://github.com/rbenv/ruby-build.git
PREFIX=/usr/local sudo ./ruby-build/install.sh
export MAKEFLAGS="-j$(nproc)"
export RUBY_CONFIGURE_OPTS="--disable-shared --disable-install-doc --disable-install-rdoc"
sudo ruby-build ${{ matrix.ruby_version }} /opt/rubies/${{ matrix.ruby_version }}
fi
- name: Bundle install
run: bundle install -j3
- name: πŸ§ͺ Run tests
shell: bash
run: |
ulimit -c unlimited
bundle exec rake test