diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02423916..243d7c12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 ] @@ -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 }} @@ -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 @@ -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 }} @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d98663f..bff2b19c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} @@ -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 diff --git a/lib/emf2svg/recipe.rb b/lib/emf2svg/recipe.rb index 4a132b0c..98b82501 100644 --- a/lib/emf2svg/recipe.rb +++ b/lib/emf2svg/recipe.rb @@ -80,7 +80,7 @@ def target_triplet when /\Ax64-mingw(32|-ucrt)/ "x64-mingw-static" else - "unknown" + nil end end # rubocop:enable Metrics/CyclomaticComplexity @@ -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 @@ -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