Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: BAZEL to SBT migration (DEV-508) #2002

Merged
merged 46 commits into from Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b2d438a
bring sbt configuration back
mpro7 Feb 15, 2022
5d1204a
wip: update dependencies
mpro7 Feb 15, 2022
270e189
fix deprecation warnings
subotic Feb 16, 2022
ca96565
add ZIO + update some deps + cleanup
mpro7 Feb 16, 2022
6f97120
add missing deps from current setup
mpro7 Feb 16, 2022
1e714c0
fix compilation error
mpro7 Feb 16, 2022
29f1c9a
fix more compilation errors
mpro7 Feb 16, 2022
b0dfbe3
remove deps not needed for compilation
mpro7 Feb 16, 2022
95a49b4
build: add running build and test through SBT on Github
subotic Feb 16, 2022
16386d8
bring back all deps
mpro7 Feb 16, 2022
e5b7c70
fixing paths to test files (ongoing)
subotic Feb 16, 2022
b265186
fixing paths to test files (ongoing)
subotic Feb 16, 2022
498daa2
wip: fix test
mpro7 Feb 17, 2022
a754de0
add building of docker images on github CI
subotic Feb 17, 2022
ce84054
wip: fix more tests
mpro7 Feb 17, 2022
7e99f07
wip: fix more tests
mpro7 Feb 17, 2022
32e0b3e
fix sbt info regarding docker image
subotic Feb 18, 2022
09f149e
wip: fix more tests
mpro7 Feb 18, 2022
46c9a38
Merge remote-tracking branch 'origin/wip/DEV-508' into wip/DEV-508
subotic Feb 18, 2022
45255c9
fix bazel build
subotic Feb 18, 2022
c6d2594
ignore server version test
subotic Feb 18, 2022
2bb63ea
fix test
subotic Feb 18, 2022
9d8dc8a
wip: fix more tests
mpro7 Feb 18, 2022
47ec673
ignored 3 tests
mpro7 Feb 18, 2022
b4a7720
fix more tests
subotic Feb 18, 2022
31d3e80
tweak corespec
subotic Feb 18, 2022
316c1aa
tweak base specs
subotic Feb 18, 2022
f17fc46
tweak cache spec
subotic Feb 19, 2022
83bfacb
fix cache spec
subotic Feb 19, 2022
bd625a6
fix rejeccting route test
subotic Feb 19, 2022
444900d
fix cache spec
subotic Feb 19, 2022
7bcdfee
fix sbt
subotic Feb 19, 2022
97f6c9f
fix client test data (ongoing)
subotic Feb 20, 2022
5d66fa9
fix client test data (ongoing)
subotic Feb 20, 2022
750631e
cleanup github ci
subotic Feb 20, 2022
2b77b8a
remove redis
subotic Feb 20, 2022
fc4029b
fix bazel
subotic Feb 20, 2022
33f57dc
Merge branch 'main' into wip/DEV-508
subotic Feb 20, 2022
0d28bd7
build dsp-api docker image through sbt
subotic Feb 20, 2022
788bcb6
fix buildinfo a bit
subotic Feb 20, 2022
3617ab5
fix buildinfo
subotic Feb 21, 2022
776feb7
Merge branch 'main' into wip/DEV-508
mpro7 Feb 21, 2022
623319a
cleanup buildinfo
subotic Feb 21, 2022
caba446
review changes
mpro7 Feb 22, 2022
16d1be1
removed too much
mpro7 Feb 22, 2022
5ef0ba4
cleanup
subotic Feb 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
138 changes: 30 additions & 108 deletions .github/workflows/main.yml
Expand Up @@ -7,13 +7,18 @@ on:

jobs:
compile:
name: Build Everything
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
Expand All @@ -32,15 +37,24 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: run build everything
run: bazel build //...
- name: Coursier cache
uses: coursier/cache-action@v6
- name: Build and Test
run: make test
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true

# ------------------------------------------
# ------------------------------------------
# Test client-test-data
client-test-data-tests:
name: Test client-test-data
needs: compile
name: Test client-test-data
runs-on: ubuntu-latest
steps:
- name: checkout source
Expand All @@ -65,113 +79,24 @@ jobs:
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect redis-tools unzip
mpro7 marked this conversation as resolved.
Show resolved Hide resolved
- name: Coursier cache
uses: coursier/cache-action@v6
- name: generate api-client-test-data
run: make client-test-data
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true

# ------------------------------------------
# ------------------------------------------

api-unit-tests:
name: API Unit Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.date.outputs.date }} }}
- name: run API unit tests
run: make test-unit

api-e2e-tests:
name: API E2E Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: install requirements
run: sudo apt-get install ca-certificates-java expect redis-tools unzip
- name: run API E2E tests
run: make test-e2e

api-integration-tests:
name: API Integration Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v1
with:
fetch-depth: 15
- name: get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD
utcOffset: "+02:00"
- name: use daily bazel disk cache
uses: actions/cache@v2
with:
path: ~/.bazel_disk_cache
key: ${{ runner.OS }}-bazel_disk_cache-${{ steps.current-time.outputs.formattedTime }}
- name: setup java version
uses: joschi/setup-jdk@v2
with:
java-version: '11' # The OpenJDK version to make available on the path
architecture: 'x64' # defaults to 'x64'
- name: Install dependencies
run: |
sudo apt-get install ca-certificates-java expect
- name: run API integration tests
run: |
make test-docker
make test-it

upgrade-integration-tests:
name: Upgrade Integration Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: checkout source
Expand Down Expand Up @@ -202,7 +127,6 @@ jobs:

docs-build-test:
name: Build Docs Testrun
needs: compile
runs-on: ubuntu-latest
steps:
- name: checkout source
Expand Down Expand Up @@ -242,9 +166,7 @@ jobs:
publish:
name: Publish (on release only)
needs: [
api-unit-tests,
api-e2e-tests,
api-integration-tests,
compile,
client-test-data-tests,
upgrade-integration-tests,
docs-build-test
Expand Down
22 changes: 22 additions & 0 deletions .gitignore
@@ -1,6 +1,8 @@
/.project
.ijwb
.vscode
.bloop
.bsp
mpro7 marked this conversation as resolved.
Show resolved Hide resolved
**/.idea
**/*.iml
**/*.ipr
Expand Down Expand Up @@ -65,3 +67,23 @@ dependencies.txt
/sipi/images/082E/*
/sipi/images/originals/082E/*
/dependencies.bzl

# TODO: clean it up
mpro7 marked this conversation as resolved.
Show resolved Hide resolved
.ammonite/
.bloop/
.bsp/
.dotty-ide*
.idea/
.metals/
.vscode/
*.worksheet.sc
metals.sbt
target/
null
project/project
project/target
project/.bloop/
boot/
lib_managed/
src_managed/
project/plugins/project/
42 changes: 9 additions & 33 deletions Makefile
Expand Up @@ -39,7 +39,6 @@ docs-clean: ## cleans the project directory

.PHONY: build
build: docker-build ## build all targets (excluding docs)
@bazel build //...

.PHOBY: check-for-outdated-deps
check-for-outdated-deps: ## check for outdated maven dependencies
Expand All @@ -55,7 +54,7 @@ buildifier: ## format Bazel WORKSPACE and BUILD.bazel files

.PHONY: docker-build-knora-api-image
docker-build-knora-api-image: # build and publish knora-api docker image locally
@bazel run //docker/knora-api:image
@sbt "webapi / Docker / publishLocal"

.PHONY: docker-publish-knora-api-image
docker-publish-knora-api-image: # publish knora-api image to Dockerhub
Expand Down Expand Up @@ -201,38 +200,15 @@ stack-db-only: env-file docker-build-knora-jena-fuseki-image ## starts only fus
test-docker: docker-build ## runs Docker image tests
bazel test //docker/...

.PHONY: test-webapi
test-webapi: docker-build ## runs all dsp-api tests.
bazel test //webapi/...

.PHONY: test-unit
test-unit: docker-build ## runs the dsp-api unit tests.
bazel test \
//webapi/src/test/scala/org/knora/webapi/http/... \
//webapi/src/test/scala/org/knora/webapi/messages/... \
//webapi/src/test/scala/org/knora/webapi/other/... \
//webapi/src/test/scala/org/knora/webapi/responders/... \
//webapi/src/test/scala/org/knora/webapi/routing/... \
//webapi/src/test/scala/org/knora/webapi/store/... \
//webapi/src/test/scala/org/knora/webapi/util/... \

.PHONY: test-e2e
test-e2e: docker-build ## runs the dsp-api e2e tests.
bazel test //webapi/src/test/scala/org/knora/webapi/e2e/...

.PHONY: client-test-data
client-test-data: docker-build ## runs the dsp-api e2e tests and generates client test data.
docker-compose -f docker-compose.yml up -d redis
$(CURRENT_DIR)/webapi/scripts/clear-client-test-data.sh
bazel test --cache_test_results=no //webapi/src/test/scala/org/knora/webapi/e2e/... --action_env=KNORA_WEBAPI_COLLECT_CLIENT_TEST_DATA=true
$(CURRENT_DIR)/webapi/scripts/dump-client-test-data.sh

.PHONY: test-it
test-it: docker-build ## runs the dsp-api integration tests.
bazel test //webapi/src/test/scala/org/knora/webapi/it/...
client-test-data: export KNORA_WEBAPI_COLLECT_CLIENT_TEST_DATA := true
client-test-data: build ## runs the dsp-api e2e tests and generates client test data.
$(CURRENT_DIR)/webapi/scripts/zap-client-test-data.sh
sbt -v "webapi/testOnly *E2ESpec *R2RSpec"
$(CURRENT_DIR)/webapi/scripts/zip-client-test-data.sh

.PHONY: test-repository-upgrade
test-repository-upgrade: init-db-test-minimal ## runs DB upgrade integration test
test-repository-upgrade: build init-db-test-minimal ## runs DB upgrade integration test
@rm -rf $(CURRENT_DIR)/.tmp/knora-test-data/v7.0.0/
@mkdir -p $(CURRENT_DIR)/.tmp/knora-test-data/v7.0.0/
@unzip $(CURRENT_DIR)/test_data/v7.0.0/v7.0.0-knora-test.trig.zip -d $(CURRENT_DIR)/.tmp/knora-test-data/v7.0.0/
Expand All @@ -245,8 +221,8 @@ test-repository-upgrade: init-db-test-minimal ## runs DB upgrade integration tes
@$(MAKE) -f $(THIS_FILE) stack-up

.PHONY: test
test: docker-build ## runs all test targets.
bazel test //webapi/...
test: build ## runs all tests
sbt -v +test

#################################
## Database Management
Expand Down