Skip to content

Commit 7ef6945

Browse files
Setup CI logic and license (#1)
* Setup CI logic and license * Apply suggestions from code review Co-authored-by: jnnfr <[email protected]>
1 parent bc745ef commit 7ef6945

11 files changed

+343
-24
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @qbicsoftware/itss
2+

.github/pr-labels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
feature: ['feature/*', 'feat/*']
2+
fix: ['fix/*', 'hotfix']
3+
chore: ['chore/*', 'documentation/*', 'docs/*', 'ci/*', 'refactor/*']

.github/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- JohnnyQ5
7+
- github-actions
8+
categories:
9+
- title: New Features 🚀
10+
labels:
11+
- feature
12+
- title: Bugfixes 🪲
13+
labels:
14+
- fix
15+
- title: Documentation & CI 🪂
16+
labels:
17+
- chore
18+
- title: Others 🧃
19+
labels:
20+
- "*"

.github/workflows/build_package.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build Maven Package
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [ main, master ]
10+
11+
jobs:
12+
package:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 1.17
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.17
21+
- name: Load local Maven repository cache
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.m2/repository
25+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26+
restore-keys: |
27+
${{ runner.os }}-maven-
28+
- name: Run mvn package
29+
run: mvn -B package --file pom.xml

.github/workflows/codeql-analysis.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main, master, development, release/*, hotfix/* ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main, master ]
20+
schedule:
21+
- cron: '21 1 * * 4'
22+
23+
jobs:
24+
analyze:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
actions: read
28+
contents: read
29+
security-events: write
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
language: [ 'java' ]
35+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
36+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
41+
- name: Set up JDK 1.17
42+
uses: actions/setup-java@v1
43+
with:
44+
java-version: 1.17
45+
settings-path: ${{ github.workspace }}
46+
47+
- name: Load local Maven repository cache
48+
uses: actions/cache@v2
49+
with:
50+
path: ~/.m2/repository
51+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
52+
restore-keys: |
53+
${{ runner.os }}-maven-
54+
55+
# Initializes the CodeQL tools for scanning.
56+
- name: Initialize CodeQL
57+
uses: github/codeql-action/init@v1
58+
with:
59+
languages: ${{ matrix.language }}
60+
# If you wish to specify custom queries, you can do so here or in a config file.
61+
# By default, queries listed here will override any specified in a config file.
62+
# Prefix the list here with "+" to use these queries and those in the config file.
63+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
64+
65+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
66+
# If this step fails, then you should remove it and run the build manually (see below)
67+
- name: Autobuild
68+
uses: github/codeql-action/autobuild@v1
69+
70+
# ℹ️ Command-line programs to run using the OS shell.
71+
# 📚 https://git.io/JvXDl
72+
73+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
74+
# and modify them (or add more) to build your code if your project
75+
# uses a compiled language
76+
77+
#- run: |
78+
# make bootstrap
79+
# make release
80+
81+
- name: Perform CodeQL Analysis
82+
uses: github/codeql-action/analyze@v1

.github/workflows/create-release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionTag:
7+
description: 'Version Tag (semantic version)'
8+
required: true
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 1.17
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.17
19+
settings-path: ${{ github.workspace }}
20+
21+
- name: Load local Maven repository cache
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.m2/repository
25+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26+
restore-keys: |
27+
${{ runner.os }}-maven-
28+
- name: Set up git
29+
run: |
30+
git config --global user.email "[email protected]"
31+
git config --global user.name "JohnnyQ5"
32+
- name: Set version in Maven project
33+
run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }}
34+
35+
- name: Build with Maven
36+
run: mvn -B package --file pom.xml
37+
38+
- name: Create Release Notes
39+
if: ${{ !startsWith(github.ref, 'refs/tags/')
40+
&& !( contains(github.event.inputs.versionTag, 'alpha')
41+
|| contains(github.event.inputs.versionTag, 'beta')
42+
|| contains(github.event.inputs.versionTag, 'rc')) }}
43+
uses: actions/[email protected]
44+
with:
45+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
46+
script: |
47+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
48+
tag_name: "${{ github.event.inputs.versionTag }}",
49+
generate_release_notes: true
50+
});
51+
- name: Create Pre-Release Notes
52+
if: ${{ !startsWith(github.ref, 'refs/tags/')
53+
&& ( contains(github.event.inputs.versionTag, 'alpha')
54+
|| contains(github.event.inputs.versionTag, 'beta')
55+
|| contains(github.event.inputs.versionTag, 'rc')) }}
56+
uses: actions/[email protected]
57+
with:
58+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
59+
script: |
60+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
61+
tag_name: "${{ github.event.inputs.versionTag }}",
62+
generate_release_notes: true,
63+
prerelease: true
64+
});
65+
- name: Publish artefact to QBiC Nexus Repository
66+
run: mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml deploy
67+
env:
68+
MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }}
69+
MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
70+
71+
- name: Switch to new branch
72+
run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }}
73+
74+
- name: Set remote branch
75+
run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }}
76+
77+
- name: Checkin commit
78+
run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}'
79+
80+
- name: Push to Github
81+
run: git push
82+
83+
- name: Open PR with version bump
84+
uses: actions/[email protected]
85+
with:
86+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
87+
script: |
88+
await github.request(`POST /repos/${{ github.repository }}/pulls`, {
89+
title: 'Update version to ${{ github.event.inputs.versionTag }}',
90+
head: 'release/set-version-to-${{ github.event.inputs.versionTag }}',
91+
base: 'main'
92+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Label Pull Requests
2+
3+
on:
4+
pull_request:
5+
types: [ opened, edited ]
6+
7+
jobs:
8+
label:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: TimonVS/pr-labeler-action@v3
12+
with:
13+
configuration-path: .github/pr-labels.yml # optional, .github/pr-labeler.yml is the default value
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will build a package using Maven and then publish it to
2+
# qbic-repo.qbic.uni-tuebingen.de packages when a release is created
3+
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
4+
5+
name: Nexus Package
6+
7+
on:
8+
push:
9+
branches:
10+
- development
11+
12+
jobs:
13+
publish_snapshot:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 1.17
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.17
23+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
24+
settings-path: ${{ github.workspace }}
25+
26+
- name: Load local Maven repository cache
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.m2/repository
30+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: |
32+
${{ runner.os }}-maven-
33+
# Remove existing snapshot tags which are not supposed to be present
34+
- name: Remove snapshot tags
35+
run: mvn versions:set -DremoveSnapshot
36+
# Set the SNAPSHOT for this build and deployment
37+
- name: Set version in Maven project
38+
run: mvn versions:set -DnewVersion='${project.version}-SNAPSHOT'
39+
40+
- name: Build with Maven
41+
run: mvn -B package --file pom.xml
42+
43+
- name: Publish artefact to QBiC Nexus Repository
44+
run: mvn --quiet --activate-profiles development-build,!release-build --settings $GITHUB_WORKSPACE/.github.settings.xml deploy
45+
env:
46+
MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }}
47+
MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
48+

.github/workflows/run_tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Maven Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [ main, master ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 1.17
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.17
21+
22+
- name: Load local Maven repository cache
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+
30+
- name: Run tests
31+
run: mvn clean verify

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022, University of Tuebingen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

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

0 commit comments

Comments
 (0)