Skip to content

bump

bump #23

Workflow file for this run

name: Ruby
on: push
jobs:
# borrowed from https://github.com/bytecodealliance/cargo-wasi/
# workflow setup
cross_compile:
strategy:
matrix:
target:
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
- name: Set up Rust
id: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
components: rustfmt, clippy
# Target older versions of OSX (as old as we reasonably can) to ensure we
# can run across a wide variety of systems.
- name: Configure OSX deployment target
if: matrix.os == 'macos-latest'
run: |
echo MACOSX_DEPLOYMENT_TARGET=10.7 >> $GITHUB_ENV
# Fixing caching on Mac, we install gnu-tar because BSD tar is buggy on Github's macos machines
# REF: https://github.com/actions/cache/issues/403
- name: MacOS caching fix
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- uses: actions/cache@v3
with:
path: |
$CARGO_HOME/bin/
$CARGO_HOME/registry/index/
$CARGO_HOME/registry/cache/
$CARGO_HOME/git/db/
target
key: ${{ runner.os }}-${{matrix.target}}-cargo-${{ steps.toolchain.outputs.rustc_hash}}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{matrix.target}}-gems-${{ hashFiles('**/Gemfile.lock')}}-${{ hashFiles('**/.tool-versions') }}
- name: Prepare ruby gems
run: |
bundle config path vendor/bundle
bundle config jobs 4
bundle install
- name: Build shared library
run: |
bundle exec rake build
ls -l ext/
- name: Rust test
uses: actions-rs/cargo@v1
with:
command: test
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
- name: Rust styling check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Ruby styling check
run: bundle exec rubocop --display-cop-names
- name: Tests
run: bundle exec rspec
- uses: actions/upload-artifact@v2
with:
name: rusty_json_schema-${{matrix.target}}
path: ext/*.default
build:
needs: [cross_compile]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- uses: actions/download-artifact@v2
- name: Unpack prebuild libraries
run: |
mv rusty_json_schema-x86_64-apple-darwin/*.default ext/
mv rusty_json_schema-x86_64-unknown-linux-gnu/*.default ext/
mv rusty_json_schema-aarch64-unknown-linux-gnu/*.default ext/
- name: Build gem
run: gem build *.gemspec
- uses: actions/upload-artifact@v2
with:
name: rusty_json_schema.gem
path: '*.gem'
integration_test:
needs: [build]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
ruby:
- 2.6
- 2.7
- 3.0
- 3.1
- 3.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/download-artifact@v2
with:
name: rusty_json_schema.gem
- name: Install gem
run: gem install *.gem
- name: Test
run: ./bin/integration
wait-before-release:
needs: [integration_test]
runs-on: ubuntu-latest
steps:
- name: Wait for status checks
run: echo "Build matrix complete"
release:
if: github.ref == 'refs/heads/main'
name: Publish to GitHub Packages
needs: [wait-before-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-ruby@v1
- uses: actions/download-artifact@v2
- name: remove old builds
run: |
rm -rf *.gem
- uses: babbel/publish-gem@v1