From 2a1caf913363a72e754f4fd058dcb72825cc106d Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Fri, 23 Sep 2022 12:10:11 +0900 Subject: [PATCH 1/2] Define CI workflow with Github Actinos --- .github/workflows/ruby.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..4119b44 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,45 @@ +name: Run Unit Tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + test: + name: Test + strategy: + matrix: + ruby-version: ['2.7', '3.0', '3.1'] + os: ['ubuntu-latest', 'macos-latest'] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake test + + test-with-system-lib: + name: Test with system library + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Prepare libjsonnet + run: sudo apt install libjsonnet-dev + - name: Run tests + run: env JSONNET_USE_SYSTEM_LIBRARIES=1 bundle exec rake test From b5f9fd11087e908540f8633eef8c6f40e108852c Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Sat, 24 Sep 2022 20:12:47 +0900 Subject: [PATCH 2/2] Always use C++ linker because the system library for libjsonnet can be a static library in some environments --- ext/jsonnet/extconf.rb | 13 +++++++------ lib/jsonnet/version.rb | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/jsonnet/extconf.rb b/ext/jsonnet/extconf.rb index 742abc7..c5100f1 100644 --- a/ext/jsonnet/extconf.rb +++ b/ext/jsonnet/extconf.rb @@ -77,12 +77,13 @@ def target_object_files $LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH $CPPFLAGS << " -I#{recipe.path}/include" - # jsonnet_wrap extension must be linked with c++ stdlib because - # the C++ library Rapid YAML is being statically linked. - rbconfig = RbConfig::MAKEFILE_CONFIG - if rbconfig['LDSHAREDXX'] - rbconfig['LDSHARED'] = rbconfig['LDSHAREDXX'] - end +end + +# jsonnet_wrap extension must be linked with c++ stdlib because +# the C++ library Rapid YAML is being statically linked. +rbconfig = RbConfig::MAKEFILE_CONFIG +if rbconfig['LDSHAREDXX'] + rbconfig['LDSHARED'] = rbconfig['LDSHAREDXX'] end abort 'libjsonnet.h not found' unless have_header('libjsonnet.h') diff --git a/lib/jsonnet/version.rb b/lib/jsonnet/version.rb index 4e3ae4c..23a0db7 100644 --- a/lib/jsonnet/version.rb +++ b/lib/jsonnet/version.rb @@ -1,3 +1,3 @@ module Jsonnet - VERSION = "0.5.1" + VERSION = "0.5.2" end