Bump to v0.9.81 #1317
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "head"] | |
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 | |
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@v3 | |
- 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: script/ci/upload-on-failure.sh "bundle exec rake test:examples" "examples-test" "./examples" | |
- name: π§ͺ Cargo test | |
shell: bash | |
run: bundle exec rake test:cargo | |
- name: π Gem test | |
run: bundle exec rake test:gem | |
- name: π¨ Smoke test | |
shell: bash | |
run: | | |
set -ex | |
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@v3 | |
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.1.3"] | |
sys: | |
- os: ubuntu-latest | |
rust_toolchain: stable | |
runs-on: ${{ matrix.sys.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
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 | |
run: bundle exec rake test |