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.3.24 # Forcing bundler version to ensure that it is consistent everywhere and # does not cause bundler gem reinstalls # bundler/rubygems 2.3.22 is a minimal requirement to support gnu/musl differentiation # https://github.com/rubygems/rubygems/pull/4488 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@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby.version }} rubygems: ${{ matrix.ruby.rubygems }} bundler: ${{ env.BUNDLER_VER }} bundler-cache: true - if: matrix.os == 'macos-latest' run: | brew install lcdf-typetools bundle exec rspec env: TEST_ENV: CI - if: matrix.os != 'macos-latest' run: bundle exec rspec --tag ~dev env: TEST_ENV: CI archlinux-test: name: Test on Arch Linux runs-on: ubuntu-latest container: image: 'archlinux:latest' strategy: fail-fast: false steps: - uses: actions/checkout@v3 - name: Setup packages run: pacman -Syu --noconfirm git ruby binutils gcc autoconf make libffi - run: bundle install - name: Test run: bundle exec rspec --tag ~dev metanorma: name: Test 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 || matrix.os == 'windows-latest' }} # workaround https://github.com/metanorma/metanorma/issues/288 strategy: fail-fast: false max-parallel: 5 matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} steps: - uses: actions/checkout@v3 with: repository: metanorma/metanorma - uses: actions/checkout@master with: path: "fontist" - run: 'echo ''gem "fontist", path: "./fontist"'' > Gemfile.devel' - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby.version }} rubygems: ${{ matrix.ruby.rubygems }} bundler: ${{ env.BUNDLER_VER }} bundler-cache: true - uses: metanorma/metanorma-build-scripts/inkscape-setup-action@main - run: bundle exec rake release: name: Release gem needs: [ test, archlinux-test, metanorma ] runs-on: ubuntu-latest if: contains(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 bundler-cache: true - uses: actions-mn/gem-release@main with: api-key: ${{ secrets.FONTIST_CI_RUBYGEMS_API_KEY }} release-command: bundle exec rake release