Skip to content

Commit

Permalink
Workaround for vcpkg/fontconfig issue
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Apr 12, 2022
1 parent 220d30a commit 54a21df
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 113 deletions.
126 changes: 75 additions & 51 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
Expand All @@ -26,7 +25,15 @@ jobs:
bundler-cache: true
ruby-version: ${{ matrix.ruby-version }}

- run: bundle exec rake --trace || cat /tmp/1/configure.log
# 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: bundle exec rake

build:
runs-on: ${{ matrix.os }}
Expand All @@ -50,26 +57,34 @@ jobs:
platform: x86_64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

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

- run: bundle exec rake gem:native:${{ matrix.platform }} --trace
# 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
- uses: actions/upload-artifact@v2
with:
name: pkg
path: pkg/*.gem
- run: bundle exec rake gem:native:${{ matrix.platform }}

- name: Install gem
run: gem install -b pkg/emf2svg-*.gem
- uses: actions/upload-artifact@v2
with:
name: pkg
path: pkg/*.gem

- name: Install gem
run: gem install -b pkg/emf2svg-*.gem

- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
test-build:
needs: build
Expand Down Expand Up @@ -104,27 +119,36 @@ jobs:
ruby-version: '2.7'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- uses: actions/download-artifact@v2
with:
name: pkg
path: pkg

- uses: actions/download-artifact@v2
with:
name: pkg
path: pkg
# 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
- name: Install native gem
if: matrix.platform == 'any'
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
- name: Install native gem
if: matrix.platform == 'any'
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem

- name: Install binary gem
if: matrix.platform != 'any'
run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem
- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
- name: Install binary gem
if: matrix.platform != 'any'
run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem

- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
cross:
runs-on: ${{ matrix.os }}
Expand All @@ -138,25 +162,25 @@ jobs:
platform: arm64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Install packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
- name: Install packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- run: bundle exec rake gem:native:${{ matrix.platform }}
- run: bundle exec rake gem:native:${{ matrix.platform }}

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

- name: Install gem
run: gem install -b pkg/emf2svg-*.gem
- name: Install gem
run: gem install -b pkg/emf2svg-*.gem
124 changes: 66 additions & 58 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,34 @@ jobs:
platform: x86_64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

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

- run: bundle exec rake gem:native:${{ matrix.platform }}
# 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
- uses: actions/upload-artifact@v2
with:
name: pkg
path: pkg/*.gem
- run: bundle exec rake gem:native:${{ matrix.platform }}

- name: Install gem
run: gem install -b pkg/emf2svg-*.gem
- uses: actions/upload-artifact@v2
with:
name: pkg
path: pkg/*.gem

- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
- name: Install gem
run: gem install -b pkg/emf2svg-*.gem

- name: Test conversion
run: |
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
cross:
runs-on: ${{ matrix.os }}
Expand All @@ -64,56 +72,56 @@ jobs:
platform: arm64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Install packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
- name: Install packages
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- run: bundle exec rake gem:native:${{ matrix.platform }}
- run: bundle exec rake gem:native:${{ matrix.platform }}

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

- name: Install gem
run: gem install -b pkg/emf2svg-*.gem
- name: Install gem
run: gem install -b pkg/emf2svg-*.gem

publish:
needs: [ build, cross ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- uses: actions/download-artifact@v2
with:
name: pkg
path: pkg

- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{secrets.METANORMA_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
ls -l pkg/
for gem in pkg/*.gem; do gem push -V $gem; done
- uses: actions/checkout@v2

- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- uses: actions/download-artifact@v2
with:
name: pkg
path: pkg

- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{secrets.METANORMA_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
ls -l pkg/
for gem in pkg/*.gem; do gem push -V $gem; done
7 changes: 3 additions & 4 deletions lib/emf2svg/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def target_triplet
when /\Ax64-mingw(32|-ucrt)/
"x64-mingw-static"
else
"unknown"
nil
end
end
# rubocop:enable Metrics/CyclomaticComplexity
Expand All @@ -96,7 +96,7 @@ def configure_defaults
opts << "-DCMAKE_BUILD_TYPE=Release"
opts << "-DLONLY=ON"

if not target_triplet.eql? "unknown" and not host_platform.eql? target_platform
unless target_triplet.nil? "unknown" or host_platform.eql? target_platform
opts << " -DVCPKG_TARGET_TRIPLET=#{target_triplet}"
end

Expand Down Expand Up @@ -143,8 +143,7 @@ def message(text)
private

def tmp_path
# @tmp_path ||= Dir.mktmpdir
@tmp_path = "/tmp/1"
@tmp_path ||= Dir.mktmpdir
end

def port_path
Expand Down

0 comments on commit 54a21df

Please sign in to comment.