Skip to content

Merge branch 'main' of github.com:fontist/extract_ttc into main #94

Merge branch 'main' of github.com:fontist/extract_ttc into main

Merge branch 'main' of github.com:fontist/extract_ttc into main #94

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@master
with:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.rubygems }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: true
- run: bundle exec rake compile
- run: bundle exec rake
package-rake-compiler-dock:
name: Package native extensions (linux-gnu, windows, macos)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@master
with:
ruby-version: 3.1
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: false
# bundler-cache:true breaks rake-compiler-dock logic
- run: bundle install --jobs 4 --retry 3
- run: bundle exec rake gem:parallel
- run: bundle exec rake build
- uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg/*.gem
package-linux-musl-aarch64:
name: Package linux-musl-aarch64 extension
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# https://github.com/marketplace/actions/run-on-architecture
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: aarch64
distro: alpine_latest
# Not required, but speeds up builds
githubToken: ${{ github.token }}
dockerRunArgs: --volume "${PWD}:/_a"
install: apk --no-cache --upgrade add git ruby-dev build-base autoconf
run: |
cd /_a
gem install bundler:${{ env.BUNDLER_VER }}
bundle install
bundle exec rake native gem
- uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg/*.gem
package-linux-musl-x86_64:
name: Package linux-musl-x86_64 extension
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- name: Install packages
run: apk --no-cache --upgrade add git ruby-dev build-base autoconf
- name: Configure git
run: git config --global --add safe.directory $(pwd)
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
gem install bundler:${{ env.BUNDLER_VER }}
bundle install
- name: Build native extension
run: bundle exec rake native gem
- uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg/*.gem
release:
name: Release gem
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
needs: [test, package-rake-compiler-dock, package-linux-musl-x86_64, package-linux-musl-aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: pkg
path: pkg
- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}
run: |
mkdir -p ~/.gem
touch ~/.gem/credentials
cat > ~/.gem/credentials << EOF
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
gem signin
mkdir tmp
for gem in pkg/*.gem; do gem push -V $gem; done
# for gem in pkg/*.gem; do echo "Will call 'gem push -V $gem'"; done