Skip to content

Commit

Permalink
chore: Build and test with Java 17 and 21 (DEV-2816) (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone authored Oct 19, 2023
1 parent e1b6eeb commit 8be4f86
Show file tree
Hide file tree
Showing 4 changed files with 704 additions and 28 deletions.
10 changes: 7 additions & 3 deletions .github/actions/preparation/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: "Preparation"
description: "Preparation steps to run tests"

inputs:
java-version:
description: "Java version to use"
required: false
default: "17"
runs:
using: "composite"
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK ${{ inputs.java-version }}
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-version: ${{ inputs.java-version }}
cache: sbt
33 changes: 20 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
steps:
- name: Run preparatory steps
uses: dasch-swiss/dsp-api/.github/actions/preparation@main
uses: dasch-swiss/dsp-api/.github/actions/preparation@ecb4a08708255d657ed3b801c339909c4bc61a79
with:
java-version: ${{ matrix.java }}
- name: Run all tests
run: sbt -v coverage "webapi/test" coverageAggregate
run: ./sbtx -v coverage "webapi/test" coverageAggregate
- name: WebApi Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand All @@ -35,20 +40,17 @@ jobs:
integration-test:
name: Build and integration-test
runs-on: actuated
strategy:
matrix:
java: [ '17', '21' ]
concurrency:
group: ${{ github.ref }}-it
group: ${{ github.ref }}-${{ matrix.java }}-it
cancel-in-progress: true
steps:
- name: Run preparatory steps
uses: dasch-swiss/dsp-api/.github/actions/preparation@main
- name: add packages
run: |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
sudo apt-get update
sudo apt install -qyyy --no-install-recommends sbt
uses: dasch-swiss/dsp-api/.github/actions/preparation@ecb4a08708255d657ed3b801c339909c4bc61a79
with:
java-version: ${{ matrix.java }}
- name: Run all integration tests
run: make integration-test
- name: WebApi Integration Test Report
Expand All @@ -71,9 +73,14 @@ jobs:
zio-http-test:
name: Build and zio-http-test
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
steps:
- name: Run preparatory steps
uses: dasch-swiss/dsp-api/.github/actions/preparation@main
uses: dasch-swiss/dsp-api/.github/actions/preparation@ecb4a08708255d657ed3b801c339909c4bc61a79
with:
java-version: ${{ matrix.java }}
- name: Run all ZioHttp tests
run: make zio-http-test
- name: ZIO-Http Routes Test Report
Expand Down
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include vars.mk
#################################
# Documentation targets
#################################
SBTX = ./sbtx

.PHONY: docs-build
docs-build: ## build docs into the local 'site' folder
Expand Down Expand Up @@ -45,19 +46,19 @@ build: docker-build ## build all targets (excluding docs)

.PHONY: docker-build-dsp-api-image
docker-build-dsp-api-image: # build and publish dsp-api docker image locally
export DOCKER_BUILDKIT=1; sbt "webapi / Docker / publishLocal"
export DOCKER_BUILDKIT=1; $(SBTX) "webapi / Docker / publishLocal"

.PHONY: docker-publish-dsp-api-image
docker-publish-dsp-api-image: # publish dsp-api image to Dockerhub
export DOCKER_BUILDKIT=1; sbt "webapi / Docker / publish"
export DOCKER_BUILDKIT=1; $(SBTX) "webapi / Docker / publish"

.PHONY: docker-build-sipi-image
docker-build-sipi-image: # build and publish sipi docker image locally
export DOCKER_BUILDKIT=1; sbt "sipi / Docker / publishLocal"
export DOCKER_BUILDKIT=1; $(SBTX) "sipi / Docker / publishLocal"

.PHONY: docker-publish-sipi-image
docker-publish-sipi-image: # publish sipi image to Dockerhub
export DOCKER_BUILDKIT=1; sbt "sipi / Docker / publish"
export DOCKER_BUILDKIT=1; $(SBTX) "sipi / Docker / publish"

.PHONY: docker-build
docker-build: docker-build-dsp-api-image docker-build-sipi-image ## build and publish all Docker images locally
Expand All @@ -67,7 +68,7 @@ docker-publish: docker-publish-dsp-api-image docker-publish-sipi-image ## publis

.PHONY: docker-image-tag
docker-image-tag: ## prints the docker image tag
@sbt -Dsbt.log.noformat=true -Dsbt.supershell=false -Dsbt.ci=true -error "print dockerImageTag"
@$(SBTX) -Dsbt.log.noformat=true -Dsbt.supershell=false -Dsbt.ci=true -error "print dockerImageTag"

#################################
## Docker-Compose targets
Expand Down Expand Up @@ -190,7 +191,7 @@ stack-db-only: env-file ## starts only fuseki.
client-test-data: export KNORA_WEBAPI_COLLECT_CLIENT_TEST_DATA := true
client-test-data: build ## runs the dsp-api e2e and r2r tests and generates client-test-data.
$(CURRENT_DIR)/webapi/scripts/zap-client-test-data.sh
sbt -v "integration/testOnly *E2ESpec *E2EZioHttpSpec *R2RSpec"
$(SBTX) -v "integration/testOnly *E2ESpec *E2EZioHttpSpec *R2RSpec"
$(CURRENT_DIR)/webapi/scripts/zip-client-test-data.sh

.PHONY: test-repository-upgrade
Expand All @@ -211,15 +212,15 @@ test-all: test integration-test zio-http-test

.PHONY: test
test: ## runs all unit tests
sbt -v coverage "webapi/test" coverageAggregate
$(SBTX) -v coverage "webapi/test" coverageAggregate

.PHONY: integration-test
integration-test: docker-build-sipi-image ## runs all integration tests
sbt -v coverage "integration/test" coverageAggregate
$(SBTX) -v coverage "integration/test" coverageAggregate

.PHONY: zio-http-test
zio-http-test: ## runs tests against ZIO HTTP routes
sbt -v coverage "integration/testOnly *ZioHttpSpec" -Dkey=zio coverageAggregate
$(SBTX) -v coverage "integration/testOnly *ZioHttpSpec" -Dkey=zio coverageAggregate


#################################
Expand Down Expand Up @@ -331,7 +332,7 @@ clean-metals: ## clean SBT and Metals related stuff
@rm -rf .bsp
@rm -rf .metals
@rm -rf target
@sbt "clean"
@$(SBTX) "clean"


.PHONY: clean
Expand All @@ -351,11 +352,11 @@ clean-sipi-projects: ## deletes all files uploaded within a project

.PHONY: check
check: ## Run code formatting check
@sbt "check"
@$(SBTX) "check"

.PHONY: fmt
fmt: ## Run code formatting fix
@sbt "fmt"
@$(SBTX) "fmt"


.PHONY: help
Expand Down
Loading

0 comments on commit 8be4f86

Please sign in to comment.