From 210c0ec8b27b0a9072fef205e0db7ebc8d80497d Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Sun, 22 Feb 2026 21:16:18 +0100 Subject: [PATCH] test build --- .github/workflows/rust.yml | 57 +++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 85c2931..5f46eb9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,33 +14,46 @@ jobs: runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings + strategy: + fail-fast: false + matrix: + ruby_version: ["3.2.2"] + sys: + - os: ubuntu-latest + rust_toolchain: stable steps: - uses: actions/checkout@v3 - - name: Cache Ruby - id: cache-ruby - uses: actions/cache@v4 + - uses: oxidize-rb/actions/setup-ruby-and-rust@v1 with: - path: rubies - key: ${{ runner.os }}-ruby - - name: Install Ruby - if: steps.cache-ruby.outputs.cache-hit != 'true' - env: - CC: clang + ruby-version: none + rustup-toolchain: ${{ matrix.sys.rust_toolchain }} + cargo-cache: "sccache" + + - name: Setup env run: | - url="https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.4.tar.gz" - prefix=`pwd`/rubies/ruby-3.4 - mkdir rubies - mkdir ruby_src - curl -sSL $url | tar -xz - cd ruby-3.4.4 - mkdir build - cd build - ../configure --without-shared --prefix=$prefix - make install - - name: Add Ruby to PATH + 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@5a3ec84eff668545956fd18022155c47e93e2684 # 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: | - prefix=`pwd`/rubies/ruby-3.4 - echo $prefix/bin >> $GITHUB_PATH + 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: Clippy run: cargo clippy --all-features --verbose -- -D warnings - name: Build