.github/workflows/test-and-release.yml
name: test-and-release
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
env:
BUNDLER_VER: 2.4.22
# Forcing bundler version to ensure that it is consistent everywhere and
# does not cause bundler gem reinstalls
jobs:
prepare:
uses: metanorma/ci/.github/workflows/prepare-rake.yml@main
test:
name: Test on Ruby ${{ matrix.ruby.version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: prepare
if: needs.prepare.outputs.push-for-tag != 'true'
continue-on-error: ${{ matrix.ruby.experimental }}
strategy:
fail-fast: false
max-parallel: 5
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: true
- run: bundle exec rspec
metanorma:
name: Test with Metanorma on Ruby ${{ matrix.ruby.version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: prepare
if: needs.prepare.outputs.push-for-tag != 'true'
continue-on-error: ${{ matrix.ruby.experimental }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
repository: metanorma/metanorma
- uses: metanorma/metanorma-build-scripts/inkscape-setup-action@main
- uses: actions/checkout@v4
with:
path: excavate
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: false
- name: Install excavate from source
run: |
cd excavate
bundle install
bundle exec rake install
- name: Install metanorma
run: bundle install
- run: bundle exec rake
release:
name: Release gem
needs: [ test, metanorma ]
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: cadwallion/publish-rubygems-action@master
env:
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}