Skip to content

Commit

Permalink
Reuse ruby-matrix from metanorma/ci (#38)
Browse files Browse the repository at this point in the history
* Reuse ruby-matrix from metanorma/ci

* Fix rubocop 'Redundant escape inside regexp literal'

* Add debug step to troubleshoot missing make/cxx

* chore: update native lib to 1.7.3

* chore: add native-deps step to list dependencies

* fix: skip ldd test for aarch64-linux so
  • Loading branch information
CAMOBAP committed Aug 20, 2024
1 parent 3ac3759 commit 23fece8
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 26 deletions.
80 changes: 57 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,69 @@ concurrency:
cancel-in-progress: true

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
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
ruby-version: [ '2.7', '3.0', '3.1' ]
max-parallel: 5
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}

steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@master
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby-version }}
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}

# https://github.com/microsoft/vcpkg/issues/15931
# no good solution :(
# https://github.com/microsoft/vcpkg/issues/15931
# no good solution :(
- name: Workaround for vcpkg
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install gperf
- run: |
which make || true
which clang || true
which gcc || true
- run: bundle exec rake

build:
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: any
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
- os: ubuntu-latest
platform: x86_64-linux
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
- os: windows-latest
platform: x64-mingw32
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
- os: windows-latest
platform: x64-mingw-ucrt
ruby-version: '3.1'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
- os: macos-latest
platform: x86_64-darwin
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
steps:
- uses: actions/checkout@v3

Expand All @@ -78,6 +93,12 @@ jobs:
- run: bundle exec rake gem:native:${{ matrix.platform }}

- if: matrix.platform != 'any'
uses: metanorma/ci/native-deps-action@main
with:
libname: emf2svg
directory: lib/emf2svg

- uses: actions/upload-artifact@v3
with:
name: pkg
Expand All @@ -86,16 +107,17 @@ jobs:
cross-build:
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: aarch64-linux
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
- os: macos-latest
platform: arm64-darwin
ruby-version: '2.7'
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }}
steps:
- uses: actions/checkout@v3

Expand All @@ -114,26 +136,35 @@ jobs:
- name: Build native extension
run: bundle exec rake gem:native:${{ matrix.platform }}

- if: matrix.platform != 'aarch64-linux'
uses: metanorma/ci/native-deps-action@main
with:
libname: emf2svg
directory: lib/emf2svg

- uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg/*.gem

test-build:
needs: [ build, cross-build ]
needs: [ prepare, build, cross-build ]
runs-on: ${{ matrix.os }}

continue-on-error: ${{ matrix.ruby.experimental }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
ruby-version: [ '2.7', '3.0', '3.1' ]
max-parallel: 5
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}

steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@master
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}

- uses: actions/download-artifact@v3
with:
Expand All @@ -148,20 +179,23 @@ jobs:
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
test-build-any:
needs: [ build, cross-build ]
needs: [ prepare, build, cross-build ]
runs-on: ${{ matrix.os }}

continue-on-error: ${{ matrix.ruby.experimental }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
ruby-version: [ '2.7', '3.0', '3.1' ]
max-parallel: 5
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}

steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@master
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}

- uses: actions/download-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions lib/emf2svg/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize

@files << {
url: "https://github.com/metanorma/libemf2svg/releases/download/v#{LIBEMF2SVG_VERSION}/libemf2svg.tar.gz",
sha256: "c65f25040a351d18beb5172609a55d034245f85a1152d7f294780c6cc155d876", # rubocop:disable Layout/LineLength
sha256: "cd7934cd746752162bb559624b1cdf7af9aa5e02d6965c53d999e447a1426419", # rubocop:disable Layout/LineLength
}

@target = ROOT.join(@target).to_s
Expand Down Expand Up @@ -92,7 +92,7 @@ def install
Dir.glob(File.join(work_path, "Release", "*.dll"))
else
Dir.glob(File.join(work_path, "libemf2svg.{so,dylib}"))
.grep(/\/(?:lib)?[a-zA-Z0-9\-]+\.(?:so|dylib)$/)
.grep(/\/(?:lib)?[a-zA-Z0-9-]+\.(?:so|dylib)$/)
end
FileUtils.cp_r(libs, ROOT.join("lib", "emf2svg"), verbose: true)

Expand Down
2 changes: 1 addition & 1 deletion lib/emf2svg/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module Emf2svg
VERSION = "1.4.3"
LIBEMF2SVG_VERSION = "1.7.1"
LIBEMF2SVG_VERSION = "1.7.3"
end

0 comments on commit 23fece8

Please sign in to comment.