From 22f573916450b2f62ff40d1969fbba083902045a Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 22 May 2023 14:06:42 +0200 Subject: [PATCH 01/29] Allow usage of git dependencies with bundler --- CHANGELOG.md | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 169885a..9314cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unrelease] ### Added -- +- Install git in the docker iamges ### Changed - diff --git a/Dockerfile b/Dockerfile index 9bf57de..aaca743 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 From 80688b9f31e6526ec70ae9660c511fdbcda89e81 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 22 May 2023 14:07:01 +0200 Subject: [PATCH 02/29] fiy typo in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9314cfb..5e9e595 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unrelease] ### Added -- Install git in the docker iamges +- Install git in the docker image ### Changed - From a05e6704dd6d5759d599e727283647a520837b4b Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 10:22:05 +0200 Subject: [PATCH 03/29] Add docker.io registry login --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 051330d..1461ec7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,11 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - 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 From 0165a919e8eaf7fabd03903be609e3da9d7b3e9d Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 10:27:52 +0200 Subject: [PATCH 04/29] Add docker.io to metadata-action --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1461ec7..e4590c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,7 @@ jobs: uses: docker/metadata-action@v4 with: images: | + docker.io/aksw/jekyll-rdf ghcr.io/aksw/jekyll-rdf - name: Build and push From c92fcdaa3e2048c77c89e70835a30cc002bb1ab8 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 10:28:26 +0200 Subject: [PATCH 05/29] Remove whitespace --- .github/workflows/build.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4590c1..77eae60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,19 +18,16 @@ jobs: - 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 DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to GitHub Container Registry + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io @@ -43,8 +40,7 @@ jobs: 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 From b9326205436a87fff2d4ee0bb4eb318a338c8004 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 10:31:44 +0200 Subject: [PATCH 06/29] buildkit should be fixed since https://github.com/docker/build-push-action/issues/761#issuecomment-1406261692 --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77eae60..600ad3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,9 +43,6 @@ jobs: - 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 }} From ebeb09d95318e5fd6c586920b1846157851fb927 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 11:45:39 +0200 Subject: [PATCH 07/29] Improve Taskfile --- Taskfile.yml | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 5a24bf0..d758722 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,8 +1,13 @@ version: '3' env: + BUNDLE_PATH: .vendor + +vars: VERSION: sh: git describe --tags --dirty --always + GEM_NAME: jekyll-rdf + DOCKER_IMAGE: aksw/jekyll-rdf tasks: @@ -11,7 +16,45 @@ tasks: cmds: - task -a + info: + desc: Output some variables + cmds: + - | + echo "VERSION: {{.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}}-{{.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={{.VERSION}} -t {{.DOCKER_IMAGE}}:{{.VERSION}} . + + test:setup: + desc: Setup the test environment + cmds: + - docker run -p 3030:3030 -d stain/jena-fuseki:latest ./fuseki-server --mem /remote + - | + cd test/theme-gem + bundle install + + test: + desc: Run the tests + deps: + - task: test:setup + cmds: + - bundle exec rake test From a7c0a599243569f775f2a642c2e388995f9fce31 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 12:22:14 +0200 Subject: [PATCH 08/29] Remove .travis.yml. Close #285. --- .travis.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ba8af76..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: ruby -services: - - docker -rvm: -- 2.3.8 -- 2.5.3 -- 2.7.0 -- ruby-head -matrix: - allow_failures: - - rvm: ruby-head -before_install: -- docker run -p 3030:3030 -d stain/jena-fuseki:latest ./fuseki-server --mem /remote -- cd test/theme-gem -- bundle install -- cd ../.. -script: -- bundle exec rake test -deploy: - - provider: rubygems - api_key: - secure: D8rx4lfdlvWFjXPrHTOXudIrUpjBHu++4ebWzNcXNdk8ccNtRbkWCqK7vOp7BAXu8NXGQOT/XoHmcwuzOpaLMiPL6B+eNTPWnC2wqeQUlZcZak6btFXwMivKXRT5oyIP/UjciucLDN9jq+54fdr5M7+nJ+3D7upUA2P3ymb+69U0l0bXl9WA+c92LRi/wXXeyxdpImHym8PxBagS6GPiHswcHoeRRq5vNEmo/E9RYV5F0Kzyj8vOchO/83cDeqeQEPX969AtO0AKZczWfNx2qOBgcYcUmxfOdAooOnFYjw3A9QZgI3B/T7LC1137mCLQCcb/e0cFPiwQYxDXS8SEEd1t4t/4Tw/zUh+TFuSAbCPJz1tG91KYhcVBDzsvQh1dU0WY7TDXRrasvNU7HJ+TMGIq7nC+QvSRJ1SyKsI89aLKA8fAO06DwI/7LodG+G/0MAxFO5XLu1EBJ8k+mxdkbSqoZxSdtvvWkAUkdjWXtOtGNUhYtuVTJrzjrWUOM2YuhmnGAwJg8UgUKzDvjNCQ0Zm2q5TiYZT5nsv8FwE6zjSK7ETnp+ofW/RwxbZs7DNTDTShKAyoy2NEKrPfFvkFkoUSP3yR+e8hJpRo2hJFC/3GxgnTr4bdI814Y5UOBfGjVXUKsodMhtk0uhJCIQMm8Jri1o5600szSW+lG20KSkg= - gem: jekyll-rdf - on: - condition: $TRAVIS_RUBY_VERSION = 2.7.0 - branch: master - - provider: rubygems - api_key: - secure: D8rx4lfdlvWFjXPrHTOXudIrUpjBHu++4ebWzNcXNdk8ccNtRbkWCqK7vOp7BAXu8NXGQOT/XoHmcwuzOpaLMiPL6B+eNTPWnC2wqeQUlZcZak6btFXwMivKXRT5oyIP/UjciucLDN9jq+54fdr5M7+nJ+3D7upUA2P3ymb+69U0l0bXl9WA+c92LRi/wXXeyxdpImHym8PxBagS6GPiHswcHoeRRq5vNEmo/E9RYV5F0Kzyj8vOchO/83cDeqeQEPX969AtO0AKZczWfNx2qOBgcYcUmxfOdAooOnFYjw3A9QZgI3B/T7LC1137mCLQCcb/e0cFPiwQYxDXS8SEEd1t4t/4Tw/zUh+TFuSAbCPJz1tG91KYhcVBDzsvQh1dU0WY7TDXRrasvNU7HJ+TMGIq7nC+QvSRJ1SyKsI89aLKA8fAO06DwI/7LodG+G/0MAxFO5XLu1EBJ8k+mxdkbSqoZxSdtvvWkAUkdjWXtOtGNUhYtuVTJrzjrWUOM2YuhmnGAwJg8UgUKzDvjNCQ0Zm2q5TiYZT5nsv8FwE6zjSK7ETnp+ofW/RwxbZs7DNTDTShKAyoy2NEKrPfFvkFkoUSP3yR+e8hJpRo2hJFC/3GxgnTr4bdI814Y5UOBfGjVXUKsodMhtk0uhJCIQMm8Jri1o5600szSW+lG20KSkg= - gem: jekyll-rdf - on: - condition: $TRAVIS_RUBY_VERSION = 2.7.0 - branch: develop From f7c6b0b201e6f22183a1cc20234653be94ed509c Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 12:25:02 +0200 Subject: [PATCH 09/29] Update github actions build plan --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 600ad3f..4fd5daf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,44 @@ on: - '*' jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ['3.0', '3.1', 'head'] + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@1 + with: + ruby-version: ${{ matrix.python }} + - uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Run tests + run: task test + + release: + runs-on: ubuntu-latest + needs: test + env: + GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@1 + 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 From 9330e2059232c56744ee8d2145d83dd1847cd68d Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 12:25:26 +0200 Subject: [PATCH 10/29] Depend on jod ~> 0.3 for development --- jekyll-rdf.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index 22c1f1e..acaf6da 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -25,6 +25,6 @@ Gem::Specification.new do |s| 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 From 2ac2ac69b40fc20a3f968ee9e3c4922c2a35b173 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:09:46 +0200 Subject: [PATCH 11/29] Fix action tag --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fd5daf..07dbaeb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Ruby - uses: ruby/setup-ruby@1 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.python }} - uses: arduino/setup-task@v1 @@ -35,7 +35,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Ruby - uses: ruby/setup-ruby@1 + uses: ruby/setup-ruby@v1 with: ruby-version: '3.1' - uses: arduino/setup-task@v1 From c00ba1cc5841fdca537ed9a92d9c378695b21e44 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:11:00 +0200 Subject: [PATCH 12/29] fix ruby version matrix variable --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07dbaeb..95c6587 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.python }} + ruby-version: ${{ matrix.ruby }} - uses: arduino/setup-task@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} From 9448fed1f561a288ec25be50752029e37d12c474 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:22:56 +0200 Subject: [PATCH 13/29] Start the test container conditionally --- Taskfile.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index d758722..ca2fac8 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -44,17 +44,24 @@ tasks: cmds: - docker build --no-cache --build-arg VERSION={{.VERSION}} -t {{.DOCKER_IMAGE}}:{{.VERSION}} . + test: + desc: Run the tests + deps: + - task: test:setup + cmds: + - bundle exec rake test + test:setup: desc: Setup the test environment cmds: - - docker run -p 3030:3030 -d stain/jena-fuseki:latest ./fuseki-server --mem /remote + - task: test:setup:endpoint-container - | cd test/theme-gem bundle install - test: - desc: Run the tests - deps: - - task: test:setup + test:setup:endpoint-container: + desc: Start a saprql endpoint for the tests cmds: - - bundle exec rake test + - docker run --rm -d -p 3030:3030 --name jekyll_rdf_test_endpoint stain/jena-fuseki:latest ./fuseki-server --mem /remote + status: + - '[ "$( docker inspect --format "{{`{{.State.Running}}`}}" jekyll_rdf_test_endpoint )" = "true" ]' From 604d5e79297375752d4949eeb213b7fc4c322cdf Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:27:31 +0200 Subject: [PATCH 14/29] Output info and fetch all refs --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95c6587..7b32f70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,8 @@ jobs: ruby: ['3.0', '3.1', 'head'] steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -24,6 +26,8 @@ jobs: - uses: arduino/setup-task@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Show repository information + run: task info - name: Run tests run: task test @@ -34,6 +38,8 @@ jobs: 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: From 986d927bf412436794a61cf594fb3e169a57e11e Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:31:17 +0200 Subject: [PATCH 15/29] Install all dependencies for test --- Taskfile.yml | 1 + jekyll-rdf.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index ca2fac8..2bf311d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -58,6 +58,7 @@ tasks: - | cd test/theme-gem bundle install + - bundle install test:setup:endpoint-container: desc: Start a saprql endpoint for the tests diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index acaf6da..1ff52cc 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -17,7 +17,7 @@ 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 'test-unit', '~> 3.0' From bbb0bba10669236de67e06ba0485a2e8cc3a1fec Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:39:00 +0200 Subject: [PATCH 16/29] Remove coveralls dependency --- jekyll-rdf.gemspec | 1 - test/test_helper.rb | 2 -- 2 files changed, 3 deletions(-) diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index 1ff52cc..f6ce4a4 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -19,7 +19,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'jekyll', '>= 4.2', '>= 4.2.1' 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 'test-unit', '~> 3.0' s.add_development_dependency 'shoulda-context', '~> 1.1' s.add_development_dependency 'rspec', '~> 3.0' diff --git a/test/test_helper.rb b/test/test_helper.rb index 471ce2a..447ed2e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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"] From 733b6fc0ef53b8b9b5106f4de08947b3bc6fa12f Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 13:41:17 +0200 Subject: [PATCH 17/29] Add simple cov dependency --- jekyll-rdf.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index f6ce4a4..66a9f08 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'jekyll', '>= 4.2', '>= 4.2.1' 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 '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' From db2864b3daa1a4c33cbc7f7f9b5edc00a665d14a Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 14:10:05 +0200 Subject: [PATCH 18/29] Add coveralls action --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b32f70..dbc5a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,8 @@ jobs: run: task info - name: Run tests run: task test + - name: Coveralls + uses: coverallsapp/github-action@v2 release: runs-on: ubuntu-latest From f1bd5e9ecf2625c134971a2335d6af5901084d68 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 14:10:21 +0200 Subject: [PATCH 19/29] docker ps -a output for debug --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbc5a8c..d499a21 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,9 @@ jobs: - name: Show repository information run: task info - name: Run tests - run: task test + run: | + docker ps -a + task test - name: Coveralls uses: coverallsapp/github-action@v2 From b57116fc78bc7cccba4bbe74bb8a21a9bfe2db79 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 14:16:45 +0200 Subject: [PATCH 20/29] Run test setup first --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d499a21..7020276 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: run: task info - name: Run tests run: | + task test:setup docker ps -a task test - name: Coveralls From c7d2e1565465b20bf060824f48afbcc247e3815c Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 14:35:37 +0200 Subject: [PATCH 21/29] more debug --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7020276..08c8195 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,8 @@ jobs: run: | task test:setup docker ps -a + curl http://localhost:3030 + curl -F "graph=http://localhost:3030/remote/data/graph1" -F "file=@./test/cases/remoteGraphs/_data/knowledge-base.ttl" http://localhost:3030/remote/upload task test - name: Coveralls uses: coverallsapp/github-action@v2 From 097e1ca202c523c2427302f65e9b6e594cc12db3 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 15:41:46 +0200 Subject: [PATCH 22/29] Use graph store protocol with fuseki 4.8.0 in tests --- Taskfile.yml | 2 +- test/cases/remoteGraphs/test_remote.rb | 4 +++- test/cases/remoteSPARQL/test_remote.rb | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 2bf311d..8a49253 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -63,6 +63,6 @@ tasks: 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:latest ./fuseki-server --mem /remote + - 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" ]' diff --git a/test/cases/remoteGraphs/test_remote.rb b/test/cases/remoteGraphs/test_remote.rb index 4b82cff..54e70c9 100644 --- a/test/cases/remoteGraphs/test_remote.rb +++ b/test/cases/remoteGraphs/test_remote.rb @@ -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__) diff --git a/test/cases/remoteSPARQL/test_remote.rb b/test/cases/remoteSPARQL/test_remote.rb index 5677acd..b9d3dbf 100644 --- a/test/cases/remoteSPARQL/test_remote.rb +++ b/test/cases/remoteSPARQL/test_remote.rb @@ -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', :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" do should "keep rdf_get and rdf_property usable" do setup_jekyll File.dirname(__FILE__) From 4eb6da1d94f59d0be62ba57f4684d698a549b47c Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 15:55:47 +0200 Subject: [PATCH 23/29] The remoteSPARQL case does use the default graph --- .github/workflows/build.yml | 7 +------ test/cases/remoteSPARQL/test_remote.rb | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08c8195..dbc5a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,12 +29,7 @@ jobs: - name: Show repository information run: task info - name: Run tests - run: | - task test:setup - docker ps -a - curl http://localhost:3030 - curl -F "graph=http://localhost:3030/remote/data/graph1" -F "file=@./test/cases/remoteGraphs/_data/knowledge-base.ttl" http://localhost:3030/remote/upload - task test + run: task test - name: Coveralls uses: coverallsapp/github-action@v2 diff --git a/test/cases/remoteSPARQL/test_remote.rb b/test/cases/remoteSPARQL/test_remote.rb index b9d3dbf..0988f69 100644 --- a/test/cases/remoteSPARQL/test_remote.rb +++ b/test/cases/remoteSPARQL/test_remote.rb @@ -1,12 +1,10 @@ require 'test_helper' require 'rest_client' -require 'uri' class TestGeneral < Test::Unit::TestCase include RSpec::Matchers include RdfTestUtility - 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") + 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__) From d870849b05d494fcc242eebc022a37813953a87f Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 16:06:37 +0200 Subject: [PATCH 24/29] Add ruby 3.2 to test matrix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbc5a8c..403389a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.0', '3.1', 'head'] + ruby: ['3.0', '3.1', '3.2'] steps: - uses: actions/checkout@v3 with: From c670ced910a3642aac6152a16e28bcc025fb4807 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 16:22:22 +0200 Subject: [PATCH 25/29] Fix test descriptions --- test/cases/dontFailIfLayoutNoFound/test_prefixes.rb | 4 ++-- test/cases/pagesMissingTemplate/test_missing_template.rb | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/cases/dontFailIfLayoutNoFound/test_prefixes.rb b/test/cases/dontFailIfLayoutNoFound/test_prefixes.rb index dd31a9e..4362557 100644 --- a/test/cases/dontFailIfLayoutNoFound/test_prefixes.rb +++ b/test/cases/dontFailIfLayoutNoFound/test_prefixes.rb @@ -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")) diff --git a/test/cases/pagesMissingTemplate/test_missing_template.rb b/test/cases/pagesMissingTemplate/test_missing_template.rb index 4907081..8003abd 100644 --- a/test/cases/pagesMissingTemplate/test_missing_template.rb +++ b/test/cases/pagesMissingTemplate/test_missing_template.rb @@ -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__) @@ -11,4 +11,3 @@ class TestMissingTemplate < Test::Unit::TestCase end end end - From b0543d51f7cb07f399741a3f7785c99a2d3babfa Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 16:42:10 +0200 Subject: [PATCH 26/29] Add MissingTempalte exception to catch the error also on ruby 3.1 --- lib/jekyll/helper/rdf_hook_helper.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/helper/rdf_hook_helper.rb b/lib/jekyll/helper/rdf_hook_helper.rb index e208bd6..e52929a 100644 --- a/lib/jekyll/helper/rdf_hook_helper.rb +++ b/lib/jekyll/helper/rdf_hook_helper.rb @@ -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( @@ -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 From e71d1621845d1e049439e50f818cc2f7c95bd8cc Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 17:46:11 +0200 Subject: [PATCH 27/29] specify GEM_VERSION --- Taskfile.yml | 5 ++++- jekyll-rdf.gemspec | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 8a49253..63d4392 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,6 +6,8 @@ env: vars: VERSION: sh: git describe --tags --dirty --always + GEM_VERSION: + sh: ruby -e "puts Gem::Version.new(ARGV[0].split('-')[0] + '-' + ARGV[0].split('-')[1..].join('.'))" {{.VERSION}} GEM_NAME: jekyll-rdf DOCKER_IMAGE: aksw/jekyll-rdf @@ -21,6 +23,7 @@ tasks: cmds: - | echo "VERSION: {{.VERSION}}" + echo "GEM_VERSION: {{.GEM_VERSION}}" echo "GEM_NAME: {{.GEM_NAME}}" echo "DOCKER_IMAGE: {{.DOCKER_IMAGE}}" @@ -37,7 +40,7 @@ tasks: gem:push: desc: Push the gem to rubygems.org cmds: - - gem push {{.GEM_NAME}}-{{.VERSION}}.gem + - gem push {{.GEM_NAME}}-{{.GEM_VERSION}}.gem docker:build: desc: The list of all defined tasks diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index 66a9f08..4fc8ebb 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -1,7 +1,9 @@ # 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` + version.split('-')[0] + '-' + version.split('-')[1..].join('.') end Gem::Specification.new do |s| From 88b6f69b8cb718a75924477d37bf74beecb6a419 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 18:07:24 +0200 Subject: [PATCH 28/29] Bump version by one minor for pre-releases --- Taskfile.yml | 8 ++++---- jekyll-rdf.gemspec | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 63d4392..198f037 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,10 +4,10 @@ env: BUNDLE_PATH: .vendor vars: - VERSION: + GIT_DESCRIBE: sh: git describe --tags --dirty --always GEM_VERSION: - sh: ruby -e "puts Gem::Version.new(ARGV[0].split('-')[0] + '-' + ARGV[0].split('-')[1..].join('.'))" {{.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 @@ -22,7 +22,7 @@ tasks: desc: Output some variables cmds: - | - echo "VERSION: {{.VERSION}}" + echo "GIT_DESCRIBE: {{.GIT_DESCRIBE}}" echo "GEM_VERSION: {{.GEM_VERSION}}" echo "GEM_NAME: {{.GEM_NAME}}" echo "DOCKER_IMAGE: {{.DOCKER_IMAGE}}" @@ -45,7 +45,7 @@ tasks: docker:build: desc: The list of all defined tasks cmds: - - docker build --no-cache --build-arg VERSION={{.VERSION}} -t {{.DOCKER_IMAGE}}:{{.VERSION}} . + - docker build --no-cache --build-arg VERSION={{.GEM_VERSION}} -t {{.DOCKER_IMAGE}}:{{.GEM_VERSION}} . test: desc: Run the tests diff --git a/jekyll-rdf.gemspec b/jekyll-rdf.gemspec index 4fc8ebb..f8b7377 100644 --- a/jekyll-rdf.gemspec +++ b/jekyll-rdf.gemspec @@ -3,7 +3,12 @@ RELEASE_VERSION = case when ENV['VERSION'] then ENV['VERSION'] else version = `git describe --tags --dirty --always` - version.split('-')[0] + '-' + version.split('-')[1..].join('.') + # 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| From c9585ab1c09fdf929c1325ac192996d916cc2504 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Mon, 3 Jul 2023 18:12:29 +0200 Subject: [PATCH 29/29] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e9e595..cd292ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - +## [4.1.0] - 2023-06-03 + +### Fixed +- Support for Ruby 3.1 +- Build system + ## [4.0.4] - 2023-02-21 ### Changed