Skip to content

Commit c8596ef

Browse files
morazowjakobbraun
andauthored
#27: Migrated to maven build tool (#28)
Fixes #27 Co-authored-by: jakobbraun <jakob.braun@posteo.de>
1 parent c642f50 commit c8596ef

38 files changed

+1961
-1175
lines changed

.editorconfig

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/broken_links_checker.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ on:
44
schedule:
55
- cron: "0 5 * * *"
66
push:
7+
branches:
8+
- main
9+
pull_request:
710

811
jobs:
912
linkChecker:
1013
runs-on: ubuntu-latest
1114
steps:
1215
- uses: actions/checkout@v2
16+
- name: Configure broken links checker
17+
run: |
18+
mkdir -p ./target
19+
echo '{ "aliveStatusCodes": [429, 200] }' > ./target/broken_links_checker.json
1320
- uses: gaurav-nelson/github-action-markdown-link-check@v1
1421
with:
1522
use-quiet-mode: 'yes'
16-
use-verbose-mode: 'yes'
23+
use-verbose-mode: 'yes'
24+
config-file: ./target/broken_links_checker.json
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI Build next Java
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
java-17-compatibility:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v2
19+
with:
20+
distribution: 'temurin'
21+
java-version: 17
22+
- name: Cache local Maven repository
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
- name: Run tests and build with Maven
30+
run: |
31+
mvn --batch-mode --update-snapshots clean package -DtrimStackTrace=false \
32+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
33+
- name: Publish Test Report
34+
uses: scacap/action-surefire-report@v1
35+
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci-build.yml

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,71 @@
11
name: CI Build
22

33
on:
4-
- push
4+
push:
5+
branches:
6+
- main
7+
pull_request:
58

69
jobs:
710
build:
8-
name: Building with Scala ${{ matrix.scala }}
11+
name: Building with Scala ${{ matrix.scala-version }}
912
runs-on: ubuntu-latest
1013
strategy:
1114
fail-fast: false
1215
matrix:
13-
scala: [ 2.12.15, 2.13.6 ]
14-
16+
include:
17+
- { scala-version: 'scala2.12', project-keeper-skip: true }
18+
- { scala-version: 'scala2.13', project-keeper-skip: false }
1519
steps:
16-
- name: Checkout the Repository
20+
- name: Checkout the repository
1721
uses: actions/checkout@v2
1822
with:
1923
fetch-depth: 0
20-
21-
- name: Setup Java and Scala with JDK 11
22-
uses: olafurpg/setup-scala@v10
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v2
2326
with:
27+
distribution: 'temurin'
2428
java-version: 11
25-
26-
- name: Cache Local SBT Dependencies
29+
- name: Cache local Maven repository
2730
uses: actions/cache@v2
2831
with:
29-
path: |
30-
~/.sbt
31-
~/.ivy2/cache
32-
~/.coursier/cache/v1
33-
~/.cache/coursier/v1
34-
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
32+
path: ~/.m2/repository
33+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3534
restore-keys: |
36-
${{ runner.os }}-sbt-cache-
37-
38-
- name: Check Formatting
39-
run: sbt ++${{ matrix.scala }} scalafmtSbtCheck scalafmtCheckAll
40-
41-
- name: Run CI
42-
run: ./scripts/ci.sh
43-
env:
44-
SCALA_VERSION: ${{ matrix.scala }}
45-
46-
- name: Upload Coverage Results to Coveralls
47-
run: sbt ++${{ matrix.scala }} coveralls
48-
env:
49-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
51-
# This required because of the sonarcloud-github-action docker volume mapping.
52-
- name: Prepare for Sonar Cloud Scan
53-
if: startsWith(matrix.scala, '2.13')
35+
${{ runner.os }}-maven-
36+
- name: Cache SonarCloud packages
37+
uses: actions/cache@v2
38+
with:
39+
path: ~/.sonar/cache
40+
key: ${{ runner.os }}-sonar
41+
restore-keys: ${{ runner.os }}-sonar
42+
- name: Run scalafix linting
5443
run: |
55-
find . -name scoverage.xml -exec sed -i \
56-
's#/home/runner/work/import-export-udf-common-scala/import-export-udf-common-scala#/github/workspace#g' {} +
57-
58-
- name: Sonar Cloud Scan
59-
if: startsWith(matrix.scala, '2.13')
60-
uses: sonarsource/sonarcloud-github-action@master
44+
mvn --batch-mode clean compile test scalafix:scalafix \
45+
-P${{ matrix.scala-version }} \
46+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
47+
-DtrimStackTrace=false
48+
- name: Run tests and build with Maven
49+
run: |
50+
mvn --batch-mode verify \
51+
-P${{ matrix.scala-version }} \
52+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
53+
-DtrimStackTrace=false \
54+
-Dproject-keeper.skip=${{ matrix.project-keeper-skip }}
55+
- name: Publish Test Report
56+
uses: scacap/action-surefire-report@v1
57+
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && startsWith(matrix.scala-version, 'scala2.13') }}
58+
with:
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
- name: Sonar analysis
61+
if: ${{ env.SONAR_TOKEN != null && startsWith(matrix.scala-version, 'scala2.13') }}
62+
run: |
63+
mvn --batch-mode scoverage:report sonar:sonar \
64+
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
65+
-DtrimStackTrace=false \
66+
-Dsonar.organization=exasol \
67+
-Dsonar.host.url=https://sonarcloud.io \
68+
-Dsonar.login=$SONAR_TOKEN
6169
env:
6270
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
64-
65-
- name: Cleanup
66-
run: |
67-
rm -rf "$HOME/.ivy2/local" || true
68-
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
69-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
70-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
71-
find $HOME/.coursier/cache -name "*.lock" -delete || true
72-
find $HOME/.sbt -name "*.lock" -delete || true
71+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Dependencies Check
2+
3+
on:
4+
schedule:
5+
- cron: "0 2 * * *"
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up JDK 11
14+
uses: actions/setup-java@v2
15+
with:
16+
distribution: 'temurin'
17+
java-version: 11
18+
- name: Cache local Maven repository
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.m2/repository
22+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: |
24+
${{ runner.os }}-maven-
25+
- name: Checking dependencies for vulnerabilities
26+
run: mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit -f pom.xml
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release Droid - Prepare Original Checksum
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- { scala-version: 'scala2.12', project-keeper-skip: true }
14+
- { scala-version: 'scala2.13', project-keeper-skip: false }
15+
steps:
16+
- name: Checkout the repository
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v2
22+
with:
23+
distribution: 'temurin'
24+
java-version: 11
25+
- name: Cache local Maven repository
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: |
31+
${{ runner.os }}-maven-
32+
- name: Run tests and build with Maven for ${{ matrix.scala-version }}
33+
run: |
34+
mvn --batch-mode clean verify --file pom.xml \
35+
-P${{ matrix.scala-version }} \
36+
-Dproject-keeper.skip=${{ matrix.project-keeper-skip }}
37+
- name: Prepare checksum
38+
run: find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + > original_checksum
39+
- name: Upload checksum to the artifactory
40+
uses: actions/upload-artifact@v2
41+
with:
42+
name: original_checksum
43+
retention-days: 5
44+
path: original_checksum
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release Droid - Print Quick Checksum
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- { scala-version: 'scala2.12', project-keeper-skip: true }
14+
- { scala-version: 'scala2.13', project-keeper-skip: false }
15+
steps:
16+
- name: Checkout the repository
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v2
22+
with:
23+
distribution: 'temurin'
24+
java-version: 11
25+
- name: Cache local Maven repository
26+
uses: actions/cache@v2
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: |
31+
${{ runner.os }}-maven-
32+
- name: Build with Maven skipping tests for ${{ matrix.scala-version }}
33+
run: |
34+
mvn --batch-mode clean verify \
35+
-P${{ matrix.scala-version }} \
36+
-DskipTests \
37+
-Dproject-keeper.skip=${{ matrix.project-keeper-skip }}
38+
- name: Print checksum
39+
run: echo 'checksum_start==';find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + | xargs;echo '==checksum_end'
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release Droid - Release On Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- { scala-version: 'scala2.12', project-keeper-skip: true }
14+
- { scala-version: 'scala2.13', project-keeper-skip: false }
15+
steps:
16+
- name: Checkout the repository
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Set up Maven Central Repository
21+
uses: actions/setup-java@v2
22+
with:
23+
distribution: 'temurin'
24+
java-version: 11
25+
server-id: ossrh
26+
server-username: MAVEN_USERNAME
27+
server-password: MAVEN_PASSWORD
28+
- name: Import GPG Key
29+
run: gpg --import --batch <(echo "${{ secrets.OSSRH_GPG_SECRET_KEY }}")
30+
- name: Cache local Maven repository
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.m2/repository
34+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: |
36+
${{ runner.os }}-maven-
37+
- name: Publish to Central Repository for ${{ matrix.scala-version }}
38+
run: |
39+
mvn clean deploy \
40+
-P${{ matrix.scala-version }} \
41+
-Dgpg.skip=false \
42+
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
43+
-DskipTests \
44+
-Dproject-keeper.skip=${{ matrix.project-keeper-skip }}
45+
env:
46+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
47+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

0 commit comments

Comments
 (0)