Skip to content

Commit 812b40a

Browse files
authored
Merge pull request #292 from AKSW/develop
Release 4.1.0
2 parents bb71b89 + c9585ab commit 812b40a

File tree

12 files changed

+146
-67
lines changed

12 files changed

+146
-67
lines changed

.github/workflows/build.yml

+54-11
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,69 @@ on:
99
- '*'
1010

1111
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
ruby: ['3.0', '3.1', '3.2']
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: ${{ matrix.ruby }}
26+
- uses: arduino/setup-task@v1
27+
with:
28+
repo-token: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Show repository information
30+
run: task info
31+
- name: Run tests
32+
run: task test
33+
- name: Coveralls
34+
uses: coverallsapp/github-action@v2
35+
36+
release:
37+
runs-on: ubuntu-latest
38+
needs: test
39+
env:
40+
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
41+
steps:
42+
- uses: actions/checkout@v3
43+
with:
44+
fetch-depth: 0
45+
- name: Set up Ruby
46+
uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: '3.1'
49+
- uses: arduino/setup-task@v1
50+
with:
51+
repo-token: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Build and release gem
53+
run: task gem:build gem:push
54+
1255
docker:
1356
runs-on: ubuntu-latest
57+
needs: test
1458
steps:
1559
- name: Git describe
1660
id: ghd
1761
uses: proudust/gh-describe@v1
1862
- name: Check outputs
1963
run: |
2064
echo "describe: ${{ steps.ghd.outputs.describe }}"
21-
-
22-
name: Set up QEMU
65+
- name: Set up QEMU
2366
uses: docker/setup-qemu-action@v2
24-
-
25-
name: Set up Docker Buildx
67+
- name: Set up Docker Buildx
2668
uses: docker/setup-buildx-action@v2
27-
-
28-
name: Login to GitHub Container Registry
69+
- name: Login to DockerHub
70+
uses: docker/login-action@v2
71+
with:
72+
username: ${{ secrets.DOCKERHUB_USERNAME }}
73+
password: ${{ secrets.DOCKERHUB_TOKEN }}
74+
- name: Login to GitHub Container Registry
2975
uses: docker/login-action@v2
3076
with:
3177
registry: ghcr.io
@@ -36,14 +82,11 @@ jobs:
3682
uses: docker/metadata-action@v4
3783
with:
3884
images: |
85+
docker.io/aksw/jekyll-rdf
3986
ghcr.io/aksw/jekyll-rdf
40-
-
41-
name: Build and push
87+
- name: Build and push
4288
uses: docker/build-push-action@v3
4389
with:
44-
# according to https://github.com/docker/build-push-action/issues/761#issuecomment-1383822381
45-
driver-opts: |
46-
image=moby/buildkit:v0.10.6
4790
push: true
4891
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
4992
build-args: VERSION=${{ steps.ghd.outputs.describe }}

.travis.yml

-33
This file was deleted.

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unrelease]
88

99
### Added
10-
-
10+
- Install git in the docker image
1111

1212
### Changed
1313
-
1414

1515
### Fixed
1616
-
1717

18+
## [4.1.0] - 2023-06-03
19+
20+
### Fixed
21+
- Support for Ruby 3.1
22+
- Build system
23+
1824
## [4.0.4] - 2023-02-21
1925

2026
### Changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CMD /usr/local/bundle/bin/jekyll build
1818
FROM ruby:3.1-slim
1919
COPY --from=builder /jekyll-rdf/docker-resources/ /docker-resources
2020
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
21-
RUN apt-get update && apt-get -y install build-essential && rm -rf /var/lib/apt/lists/*
21+
RUN apt-get update && apt-get -y install build-essential git && rm -rf /var/lib/apt/lists/*
2222

2323
WORKDIR /data
2424

Taskfile.yml

+56-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
version: '3'
22

33
env:
4-
VERSION:
4+
BUNDLE_PATH: .vendor
5+
6+
vars:
7+
GIT_DESCRIBE:
58
sh: git describe --tags --dirty --always
9+
GEM_VERSION:
10+
sh: ruby -e "if Gem::Version.new(ARGV[0]).prerelease? then puts Gem::Version.new(Gem::Version.new(ARGV[0].split('-')[0]).bump().to_s + '-' + ARGV[0].split('-')[1..].join('.')) else puts Gem::Version.new(ARGV[0]) end" {{.GIT_DESCRIBE}}
11+
GEM_NAME: jekyll-rdf
12+
DOCKER_IMAGE: aksw/jekyll-rdf
613

714
tasks:
815

@@ -11,7 +18,54 @@ tasks:
1118
cmds:
1219
- task -a
1320

21+
info:
22+
desc: Output some variables
23+
cmds:
24+
- |
25+
echo "GIT_DESCRIBE: {{.GIT_DESCRIBE}}"
26+
echo "GEM_VERSION: {{.GEM_VERSION}}"
27+
echo "GEM_NAME: {{.GEM_NAME}}"
28+
echo "DOCKER_IMAGE: {{.DOCKER_IMAGE}}"
29+
30+
install:
31+
desc: Install jekyll rdf and its dependencies with bundle
32+
cmds:
33+
- bundle install
34+
35+
gem:build:
36+
desc: Build the ruby gem
37+
cmds:
38+
- gem build {{.GEM_NAME}}.gemspec
39+
40+
gem:push:
41+
desc: Push the gem to rubygems.org
42+
cmds:
43+
- gem push {{.GEM_NAME}}-{{.GEM_VERSION}}.gem
44+
1445
docker:build:
1546
desc: The list of all defined tasks
1647
cmds:
17-
- docker build --no-cache --build-arg VERSION={{.VERSION}} -t jekyll-rdf:{{.VERSION}} .
48+
- docker build --no-cache --build-arg VERSION={{.GEM_VERSION}} -t {{.DOCKER_IMAGE}}:{{.GEM_VERSION}} .
49+
50+
test:
51+
desc: Run the tests
52+
deps:
53+
- task: test:setup
54+
cmds:
55+
- bundle exec rake test
56+
57+
test:setup:
58+
desc: Setup the test environment
59+
cmds:
60+
- task: test:setup:endpoint-container
61+
- |
62+
cd test/theme-gem
63+
bundle install
64+
- bundle install
65+
66+
test:setup:endpoint-container:
67+
desc: Start a saprql endpoint for the tests
68+
cmds:
69+
- docker run --rm -d -p 3030:3030 --name jekyll_rdf_test_endpoint stain/jena-fuseki:4.8.0 ./fuseki-server --mem /remote
70+
status:
71+
- '[ "$( docker inspect --format "{{`{{.State.Running}}`}}" jekyll_rdf_test_endpoint )" = "true" ]'

jekyll-rdf.gemspec

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# coding: utf-8
22
RELEASE_VERSION = case
33
when ENV['VERSION'] then ENV['VERSION']
4-
else `git describe --tags --dirty --always`
4+
else
5+
version = `git describe --tags --dirty --always`
6+
# if Gem::Version.new(ARGV[0]).prerelease? then puts Gem::Version.new(Gem::Version.new(ARGV[0].split('-')[0]).bump().to_s + '-' + ARGV[0].split('-')[1..].join('.')) else puts Gem::Version.new(ARGV[0]) end
7+
if Gem::Version.new(version).prerelease? then
8+
Gem::Version.new(Gem::Version.new(version.split('-')[0]).bump().to_s + '-' + version.split('-')[1..].join('.'))
9+
else
10+
Gem::Version.new(version)
11+
end
512
end
613

714
Gem::Specification.new do |s|
@@ -17,14 +24,14 @@ Gem::Specification.new do |s|
1724
s.add_runtime_dependency 'linkeddata', '~> 3.2', '>= 3.2.0'
1825
s.add_runtime_dependency 'sparql-client', '~> 3.2', '>= 3.2.0'
1926
s.add_runtime_dependency 'jekyll', '>= 4.2', '>= 4.2.1'
20-
s.add_development_dependency 'rake', '~> 13.0'
27+
s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
2128
s.add_development_dependency 'rest-client', '~> 2.0', '>= 2.0.1'
22-
s.add_development_dependency 'coveralls', '~> 0.8'
29+
s.add_development_dependency 'simplecov', '~> 0.22.0'
2330
s.add_development_dependency 'test-unit', '~> 3.0'
2431
s.add_development_dependency 'shoulda-context', '~> 1.1'
2532
s.add_development_dependency 'rspec', '~> 3.0'
2633
s.add_development_dependency 'pry-byebug', '~> 3.4'
2734
s.add_development_dependency 'rdoc', '~> 6.2', '>= 6.2.1'
28-
s.add_development_dependency 'jekyll-theme-jod', '~> 0.2'
35+
s.add_development_dependency 'jekyll-theme-jod', '~> 0.3'
2936
s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1'
3037
end

lib/jekyll/helper/rdf_hook_helper.rb

+10-7
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ def backload_prefixes page, payload
4343
base_path = page.instance_variable_get(:@base_dir)
4444
base_path ||= payload.site["source"]
4545
end
46-
rescue NoMethodError => ne
47-
#just in case the error was caused by something different then a missing template
48-
if(ne.message.eql? "undefined method `data' for nil:NilClass")
49-
return
50-
else
51-
raise
52-
end
46+
rescue MissingTemplate
47+
# the case that a template is missing
48+
# aka. undefined method `data' for nil:NilClass
49+
return
5350
end
5451
if(page.data["rdf_prefixes"].nil? && !(prefix_path.nil? || base_path.nil?))
5552
Jekyll::JekyllRdf::Helper::RdfHelper.load_prefixes(
@@ -70,7 +67,13 @@ def search_prefix_definition layout, rdf_prefix_path
7067
return nil
7168
end
7269

70+
class MissingTemplate < StandardError
71+
end
72+
7373
def check_prefix_definition layout
74+
if layout.nil?
75+
raise MissingTemplate.new "Missing template"
76+
end
7477
unless(layout.data["rdf_prefix_path"].nil?)
7578
return [layout.instance_variable_get(:@base_dir), layout.data["rdf_prefix_path"]]
7679
end

test/cases/dontFailIfLayoutNoFound/test_prefixes.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
require 'test_helper'
22

33
class TestPrefixes < Test::Unit::TestCase
4-
context "load_prefixes form RdfPageHelper" do
4+
context "load_prefixes from RdfPrefixHelper" do
55
include RdfTestUtility
6-
should "check that the prefix search doesnot fail of an undefined layout is specified" do
6+
should "check that the prefix search doesnot fail if an undefined layout is specified" do
77
setup_jekyll File.dirname(__FILE__)
88

99
blogfile = File.read(File.join(@source, "_site/2019/02/12/Blogpost.html"))

test/cases/pagesMissingTemplate/test_missing_template.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class TestMissingTemplate < Test::Unit::TestCase
44
include RdfTestUtility
5-
context "load_data form RdfPageHelper" do
5+
context "load_data from RdfPageHelper" do
66
should "exit page generation if Jekyll did not load its mapped layout" do #We can't recreate this case with MWE
77
TestHelper::setErrOutput
88
setup_jekyll File.dirname(__FILE__)
@@ -11,4 +11,3 @@ class TestMissingTemplate < Test::Unit::TestCase
1111
end
1212
end
1313
end
14-

test/cases/remoteGraphs/test_remote.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
require 'test_helper'
22
require 'rest_client'
3+
require 'uri'
34

45
class TestGeneral < Test::Unit::TestCase
56
include RSpec::Matchers
67
include RdfTestUtility
7-
RestClient.post('http://localhost:3030/remote/upload', :graph => "http://localhost:3030/remote/data/graph1", :name_of_file_param => File.new(File.join(File.dirname(__FILE__), "_data/knowledge-base.ttl")))
8+
graph_param = URI::encode_www_form("graph" => "http://localhost:3030/remote/data/graph1")
9+
RestClient.put("http://localhost:3030/remote/?" + graph_param, File.read(File.join(File.dirname(__FILE__), "_data/knowledge-base.ttl")), :content_type => "text/turtle;charset=utf-8")
810
context "A remote sparql endpoint on a specified default graph" do
911
should "keep rdf_get and rdf_property usable" do
1012
setup_jekyll File.dirname(__FILE__)

test/cases/remoteSPARQL/test_remote.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class TestGeneral < Test::Unit::TestCase
55
include RSpec::Matchers
66
include RdfTestUtility
7-
RestClient.post('http://localhost:3030/remote/upload', :name_of_file_param => File.new(File.join(File.dirname(__FILE__), "_data/knowledge-base.ttl")))
7+
RestClient.put("http://localhost:3030/remote/?default", File.read(File.join(File.dirname(__FILE__), "_data/knowledge-base.ttl")), :content_type => "text/turtle;charset=utf-8")
88
context "A remote sparql endpoint" do
99
should "keep rdf_get and rdf_property usable" do
1010
setup_jekyll File.dirname(__FILE__)

test/test_helper.rb

-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
require 'shoulda-context'
33
require 'rspec/expectations'
44
require 'simplecov'
5-
require 'coveralls'
65
require 'ResourceHelper'
76
require 'RdfTestUtility'
87

98
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
109
SimpleCov::Formatter::HTMLFormatter,
11-
Coveralls::SimpleCov::Formatter
1210
])
1311
SimpleCov.start do
1412
add_filter ["/.vendor", "/vendor", "/test"]

0 commit comments

Comments
 (0)