From 3c9a946e0025ea3ff8a63b61e87d5e855ae7bde0 Mon Sep 17 00:00:00 2001 From: Stefan Wienert Date: Wed, 27 Nov 2024 16:58:08 +0100 Subject: [PATCH] Setup Github Actions CI - don't rely on Rake in Gemspec to avoid bootstrapping issues --- .github/workflows/ruby.yml | 39 ++++++++++++++++++++++++++++++++++++++ secretariat.gemspec | 9 +++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) 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..f89ec6b --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,39 @@ + # This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.2.2', '3.3', head] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '21' + - 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 diff --git a/secretariat.gemspec b/secretariat.gemspec index 8299b99..cd11a27 100644 --- a/secretariat.gemspec +++ b/secretariat.gemspec @@ -1,5 +1,5 @@ require_relative 'lib/secretariat/version' -require 'rake' +#require 'rake' Gem::Specification.new do |s| s.name = 'secretariat' s.version = Secretariat::VERSION @@ -8,7 +8,12 @@ Gem::Specification.new do |s| s.description = "a tool to help generate and validate ZUGFeRD invoice xml files" s.authors = ["Jan Krutisch"] s.email = 'jan@krutisch.de' - s.files = FileList['lib/**/*.rb', 'bin/*.jar', 'schemas/**/*', 'README.md'] + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + s.files = Dir.chdir(File.expand_path('..', __FILE__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + end s.homepage = 'https://github.com/halfbyte/ruby-secretariat' s.license = 'Apache-2.0'