Skip to content

Commit ea79897

Browse files
authored
Initial project setup (#1)
Co-authored-by: kaklakariada <kaklakariada@users.noreply.github.com>
1 parent e48d515 commit ea79897

File tree

15 files changed

+1374
-0
lines changed

15 files changed

+1374
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Broken Links Checker
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
linkChecker:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Configure broken links checker
16+
run: |
17+
mkdir -p ./target
18+
echo '{ "aliveStatusCodes": [429, 200] }' > ./target/broken_links_checker.json
19+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
20+
with:
21+
use-quiet-mode: 'yes'
22+
use-verbose-mode: 'yes'
23+
config-file: ./target/broken_links_checker.json

.github/workflows/build.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
matrix-build:
10+
11+
permissions:
12+
contents: read
13+
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
java: [17]
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
include:
20+
- os: ubuntu-latest
21+
java: 21
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}-os-${{ matrix.os }}-java-${{ matrix.java }}
25+
cancel-in-progress: true
26+
27+
runs-on: ${{ matrix.os }}
28+
defaults:
29+
run:
30+
shell: "bash"
31+
name: "Build on ${{ matrix.os }} with Java ${{ matrix.java }}"
32+
env:
33+
DEFAULT_JAVA: 17
34+
DEFAULT_OS: ubuntu-latest
35+
36+
steps:
37+
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
42+
- uses: actions/setup-java@v4
43+
with:
44+
distribution: 'temurin'
45+
java-version: |
46+
17
47+
21
48+
cache: 'maven'
49+
50+
- name: Cache SonarQube packages
51+
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }}
52+
uses: actions/cache@v4
53+
with:
54+
path: ~/.sonar/cache
55+
key: ${{ runner.os }}-sonar
56+
restore-keys: ${{ runner.os }}-sonar
57+
58+
- name: Build with Java ${{ matrix.java }}
59+
run: |
60+
mvn --batch-mode -T 1C clean org.jacoco:jacoco-maven-plugin:prepare-agent install \
61+
-Djava.version=${{ matrix.java }}
62+
63+
- name: Sonar analysis
64+
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
65+
run: |
66+
mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
67+
-Dsonar.token=$SONAR_TOKEN
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
71+
72+
- name: Verify reproducible build
73+
run: |
74+
mvn --batch-mode -T 1C clean verify artifact:compare -DskipTests \
75+
-Djava.version=${{ matrix.java }}
76+
77+
build:
78+
needs: matrix-build
79+
runs-on: ubuntu-latest
80+
steps:
81+
- run: echo "Build successful"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 4 * * 3'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
security-events: write
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- uses: actions/setup-java@v4
28+
with:
29+
distribution: 'temurin'
30+
java-version: 17
31+
cache: 'maven'
32+
33+
- name: Initialize CodeQL
34+
uses: github/codeql-action/init@v3
35+
with:
36+
languages: java
37+
38+
- name: Autobuild
39+
uses: github/codeql-action/autobuild@v3
40+
41+
- name: Perform CodeQL Analysis
42+
uses: github/codeql-action/analyze@v3
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
6+
7+
base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )"
8+
readonly base_dir
9+
readonly pom_file="$base_dir/parent/pom.xml"
10+
11+
# Read project version from pom file
12+
project_version=$(grep "<revision>" "$pom_file" | sed --regexp-extended 's/\s*<revision>(.*)<\/revision>\s*/\1/g')
13+
readonly project_version
14+
echo "Read project version '$project_version' from $pom_file"
15+
16+
# Calculate checksum
17+
readonly artifact_path="$base_dir/product/target/openfasttrace-${project_version}.jar"
18+
echo "Calculate sha256sum for file '$artifact_path'"
19+
file_dir="$(dirname "$artifact_path")"
20+
readonly file_dir
21+
file_name=$(basename "$artifact_path")
22+
readonly file_name
23+
cd "$file_dir"
24+
readonly checksum_file_name="${file_name}.sha256"
25+
sha256sum "$file_name" > "$checksum_file_name"
26+
readonly checksum_file_path="$file_dir/$checksum_file_name"
27+
cd "$base_dir"
28+
29+
30+
# Create GitHub release
31+
readonly changes_file="$base_dir/doc/changes/changes_${project_version}.md"
32+
notes=$(cat "$changes_file")
33+
readonly notes
34+
35+
readonly title="Release $project_version"
36+
readonly tag="$project_version"
37+
echo "Creating release:"
38+
echo "Git tag : $tag"
39+
echo "Title : $title"
40+
echo "Changes file : $changes_file"
41+
echo "Artifact file: $artifact_path"
42+
echo "Checksum file: $checksum_file_path"
43+
44+
release_url=$(gh release create --latest --title "$title" --notes "$notes" --target main "$tag" "$artifact_path" "$checksum_file_path")
45+
readonly release_url
46+
echo "Release URL: $release_url"

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
skip-deploy-maven-central:
7+
description: "Skip deployment to Maven Central"
8+
required: true
9+
type: boolean
10+
default: false
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: "bash"
18+
concurrency:
19+
group: ${{ github.workflow }}
20+
cancel-in-progress: false
21+
permissions:
22+
contents: write # Required for creating GitHub release
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Fail if not running on main branch
28+
if: ${{ github.ref != 'refs/heads/main' }}
29+
uses: actions/github-script@v7
30+
with:
31+
script: |
32+
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
33+
34+
- name: Set up Maven Central Repository
35+
uses: actions/setup-java@v4
36+
with:
37+
distribution: "temurin"
38+
java-version: 17
39+
cache: "maven"
40+
server-id: ossrh
41+
server-username: MAVEN_USERNAME
42+
server-password: MAVEN_PASSWORD
43+
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
44+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
45+
46+
- name: Build
47+
run: mvn --batch-mode -T 1C clean install
48+
49+
- name: List secret GPG keys
50+
run: gpg --list-secret-keys
51+
52+
- name: Publish to Maven Central Repository
53+
if: ${{ !inputs.skip-deploy-maven-central }}
54+
run: mvn --batch-mode deploy -Possrh -DstagingDescription="Deployed via GitHub workflow release.yml"
55+
env:
56+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
57+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
58+
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
59+
60+
- name: Create GitHub Release
61+
run: ./.github/workflows/github_release.sh
62+
env:
63+
GH_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.settings/org.eclipse.core.resources.prefs
2+
/.settings/org.eclipse.jdt.apt.core.prefs
3+
/.settings/org.eclipse.m2e.core.prefs
4+
/target/
5+
/.classpath
6+
/.project

0 commit comments

Comments
 (0)