Skip to content

Commit

Permalink
Merge pull request #292 from AKSW/develop
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
white-gecko authored Jul 3, 2023
2 parents bb71b89 + c9585ab commit 812b40a
Show file tree
Hide file tree
Showing 12 changed files with 146 additions and 67 deletions.
65 changes: 54 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,69 @@ on:
- '*'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Show repository information
run: task info
- name: Run tests
run: task test
- name: Coveralls
uses: coverallsapp/github-action@v2

release:
runs-on: ubuntu-latest
needs: test
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release gem
run: task gem:build gem:push

docker:
runs-on: ubuntu-latest
needs: test
steps:
- name: Git describe
id: ghd
uses: proudust/gh-describe@v1
- name: Check outputs
run: |
echo "describe: ${{ steps.ghd.outputs.describe }}"
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to GitHub Container Registry
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand All @@ -36,14 +82,11 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
docker.io/aksw/jekyll-rdf
ghcr.io/aksw/jekyll-rdf
-
name: Build and push
- name: Build and push
uses: docker/build-push-action@v3
with:
# according to https://github.com/docker/build-push-action/issues/761#issuecomment-1383822381
driver-opts: |
image=moby/buildkit:v0.10.6
push: true
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
build-args: VERSION=${{ steps.ghd.outputs.describe }}
Expand Down
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unrelease]

### Added
-
- Install git in the docker image

### Changed
-

### Fixed
-

## [4.1.0] - 2023-06-03

### Fixed
- Support for Ruby 3.1
- Build system

## [4.0.4] - 2023-02-21

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CMD /usr/local/bundle/bin/jekyll build
FROM ruby:3.1-slim
COPY --from=builder /jekyll-rdf/docker-resources/ /docker-resources
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
RUN apt-get update && apt-get -y install build-essential && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get -y install build-essential git && rm -rf /var/lib/apt/lists/*

WORKDIR /data

Expand Down
58 changes: 56 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
version: '3'

env:
VERSION:
BUNDLE_PATH: .vendor

vars:
GIT_DESCRIBE:
sh: git describe --tags --dirty --always
GEM_VERSION:
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}}
GEM_NAME: jekyll-rdf
DOCKER_IMAGE: aksw/jekyll-rdf

tasks:

Expand All @@ -11,7 +18,54 @@ tasks:
cmds:
- task -a

info:
desc: Output some variables
cmds:
- |
echo "GIT_DESCRIBE: {{.GIT_DESCRIBE}}"
echo "GEM_VERSION: {{.GEM_VERSION}}"
echo "GEM_NAME: {{.GEM_NAME}}"
echo "DOCKER_IMAGE: {{.DOCKER_IMAGE}}"
install:
desc: Install jekyll rdf and its dependencies with bundle
cmds:
- bundle install

gem:build:
desc: Build the ruby gem
cmds:
- gem build {{.GEM_NAME}}.gemspec

gem:push:
desc: Push the gem to rubygems.org
cmds:
- gem push {{.GEM_NAME}}-{{.GEM_VERSION}}.gem

docker:build:
desc: The list of all defined tasks
cmds:
- docker build --no-cache --build-arg VERSION={{.VERSION}} -t jekyll-rdf:{{.VERSION}} .
- docker build --no-cache --build-arg VERSION={{.GEM_VERSION}} -t {{.DOCKER_IMAGE}}:{{.GEM_VERSION}} .

test:
desc: Run the tests
deps:
- task: test:setup
cmds:
- bundle exec rake test

test:setup:
desc: Setup the test environment
cmds:
- task: test:setup:endpoint-container
- |
cd test/theme-gem
bundle install
- bundle install

test:setup:endpoint-container:
desc: Start a saprql endpoint for the tests
cmds:
- docker run --rm -d -p 3030:3030 --name jekyll_rdf_test_endpoint stain/jena-fuseki:4.8.0 ./fuseki-server --mem /remote
status:
- '[ "$( docker inspect --format "{{`{{.State.Running}}`}}" jekyll_rdf_test_endpoint )" = "true" ]'
15 changes: 11 additions & 4 deletions jekyll-rdf.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# coding: utf-8
RELEASE_VERSION = case
when ENV['VERSION'] then ENV['VERSION']
else `git describe --tags --dirty --always`
else
version = `git describe --tags --dirty --always`
# 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
if Gem::Version.new(version).prerelease? then
Gem::Version.new(Gem::Version.new(version.split('-')[0]).bump().to_s + '-' + version.split('-')[1..].join('.'))
else
Gem::Version.new(version)
end
end

Gem::Specification.new do |s|
Expand All @@ -17,14 +24,14 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'linkeddata', '~> 3.2', '>= 3.2.0'
s.add_runtime_dependency 'sparql-client', '~> 3.2', '>= 3.2.0'
s.add_runtime_dependency 'jekyll', '>= 4.2', '>= 4.2.1'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
s.add_development_dependency 'rest-client', '~> 2.0', '>= 2.0.1'
s.add_development_dependency 'coveralls', '~> 0.8'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'test-unit', '~> 3.0'
s.add_development_dependency 'shoulda-context', '~> 1.1'
s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'pry-byebug', '~> 3.4'
s.add_development_dependency 'rdoc', '~> 6.2', '>= 6.2.1'
s.add_development_dependency 'jekyll-theme-jod', '~> 0.2'
s.add_development_dependency 'jekyll-theme-jod', '~> 0.3'
s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1'
end
17 changes: 10 additions & 7 deletions lib/jekyll/helper/rdf_hook_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ def backload_prefixes page, payload
base_path = page.instance_variable_get(:@base_dir)
base_path ||= payload.site["source"]
end
rescue NoMethodError => ne
#just in case the error was caused by something different then a missing template
if(ne.message.eql? "undefined method `data' for nil:NilClass")
return
else
raise
end
rescue MissingTemplate
# the case that a template is missing
# aka. undefined method `data' for nil:NilClass
return
end
if(page.data["rdf_prefixes"].nil? && !(prefix_path.nil? || base_path.nil?))
Jekyll::JekyllRdf::Helper::RdfHelper.load_prefixes(
Expand All @@ -70,7 +67,13 @@ def search_prefix_definition layout, rdf_prefix_path
return nil
end

class MissingTemplate < StandardError
end

def check_prefix_definition layout
if layout.nil?
raise MissingTemplate.new "Missing template"
end
unless(layout.data["rdf_prefix_path"].nil?)
return [layout.instance_variable_get(:@base_dir), layout.data["rdf_prefix_path"]]
end
Expand Down
4 changes: 2 additions & 2 deletions test/cases/dontFailIfLayoutNoFound/test_prefixes.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'test_helper'

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

blogfile = File.read(File.join(@source, "_site/2019/02/12/Blogpost.html"))
Expand Down
3 changes: 1 addition & 2 deletions test/cases/pagesMissingTemplate/test_missing_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

4 changes: 3 additions & 1 deletion test/cases/remoteGraphs/test_remote.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
require 'test_helper'
require 'rest_client'
require 'uri'

class TestGeneral < Test::Unit::TestCase
include RSpec::Matchers
include RdfTestUtility
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")))
graph_param = URI::encode_www_form("graph" => "http://localhost:3030/remote/data/graph1")
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")
context "A remote sparql endpoint on a specified default graph" do
should "keep rdf_get and rdf_property usable" do
setup_jekyll File.dirname(__FILE__)
Expand Down
2 changes: 1 addition & 1 deletion test/cases/remoteSPARQL/test_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class TestGeneral < Test::Unit::TestCase
include RSpec::Matchers
include RdfTestUtility
RestClient.post('http://localhost:3030/remote/upload', :name_of_file_param => File.new(File.join(File.dirname(__FILE__), "_data/knowledge-base.ttl")))
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")
context "A remote sparql endpoint" do
should "keep rdf_get and rdf_property usable" do
setup_jekyll File.dirname(__FILE__)
Expand Down
2 changes: 0 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
require 'shoulda-context'
require 'rspec/expectations'
require 'simplecov'
require 'coveralls'
require 'ResourceHelper'
require 'RdfTestUtility'

SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
add_filter ["/.vendor", "/vendor", "/test"]
Expand Down

0 comments on commit 812b40a

Please sign in to comment.