Skip to content

Commit ae0e9ac

Browse files
authored
First shot at github actions (#7)
* First shot at github actions * Homegrown file_list to replace rake function * This is embarassing...
1 parent feb0acc commit ae0e9ac

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

.github/workflows/run_tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Ruby
9+
10+
on:
11+
push:
12+
branches: [ "main" ]
13+
pull_request:
14+
branches: [ "main" ]
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
test:
21+
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
ruby-version: ['3.1', '3.2', '3.3', 'head']
26+
27+
steps:
28+
- uses: ConorMacBride/install-package@v1
29+
with:
30+
apt: default-jdk
31+
- uses: actions/checkout@v4
32+
33+
- name: Set up Ruby
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: ${{ matrix.ruby-version }}
37+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
38+
- name: Run tests
39+
run: bundle exec rake

secretariat.gemspec

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
require_relative 'lib/secretariat/version'
2-
require 'rake'
2+
3+
# Rolling my own file_list to not have to rely on rake
4+
# as this breaks ruby-setup on GitHub actions
5+
# This should be good enough for now, even though
6+
# FileList does a lot more.
7+
def file_list(*patterns)
8+
patterns.map do |pattern|
9+
Dir.glob(pattern)
10+
end.flatten.reject do |file|
11+
File.basename(file).start_with?(".")
12+
end
13+
end
14+
315
Gem::Specification.new do |s|
416
s.name = 'secretariat'
517
s.version = Secretariat::VERSION
@@ -8,7 +20,7 @@ Gem::Specification.new do |s|
820
s.description = "a tool to help generate and validate ZUGFeRD invoice xml files"
921
s.authors = ["Jan Krutisch"]
1022
s.email = 'jan@krutisch.de'
11-
s.files = FileList['lib/**/*.rb', 'bin/*.jar', 'schemas/**/*', 'README.md']
23+
s.files = file_list('lib/**/*.rb', 'bin/*.jar', 'schemas/**/*', 'README.md')
1224
s.homepage = 'https://github.com/halfbyte/ruby-secretariat'
1325
s.license = 'Apache-2.0'
1426

0 commit comments

Comments
 (0)