diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..8d7e69b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @qbicsoftware/itss diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1884871..2cb2dc7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,20 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + version: 2 -updates_configs: - - package_manager: "java:maven" - directory: "/" - update_schedule: "daily" - target-branch: development - default_labels: "dependabot" - commit-message: - prefix: "[DEPENDABOT]" +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + target-branch: "development" + labels: + - "dependabot" + commit-message: + prefix: "[DEPENDABOT]" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..fdd0f42 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,13 @@ +feature: + - any: + - head-branch: [ '^feature' ] +fix: + - any: + - head-branch: [ '^fix', '^hotfix' ] +chore: + - any: + - head-branch: [ '^chore', '^documentation', '^docs', '^ci', '^refactor' ] +release: + - all: + - base-branch: [ 'main', 'master' ] + - head-branch: [ 'development', 'dev' ] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..1a928f0 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,20 @@ +changelog: + exclude: + labels: + - ignore-for-release + authors: + - JohnnyQ5 + - github-actions + categories: + - title: New Features 🚀 + labels: + - feature + - title: Bugfixes đŸĒ˛ + labels: + - fix + - title: Documentation & CI đŸĒ‚ + labels: + - chore + - title: Others 🧃 + labels: + - "*" diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 8a28bec..77c5fe5 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -1,17 +1,31 @@ name: Build Maven Package -on: [push] +on: + push: + branches: + - '**' + pull_request: + # The branches below must be a subset of the branches above + branches: [ main, master ] jobs: - build: + package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 with: - java-version: 1.8 - + distribution: 'zulu' + java-version: '8' + - name: Load local Maven repository cache + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- - name: Run mvn package run: mvn -B package --file pom.xml diff --git a/.github/workflows/changelog-update.yml b/.github/workflows/changelog-update.yml deleted file mode 100644 index d421f65..0000000 --- a/.github/workflows/changelog-update.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Changelog update" -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] - -jobs: - # Enforces the update of a changelog file on every pull request - changelog: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: dangoslen/changelog-enforcer@v2 - with: - changeLogPath: 'CHANGELOG.rst' - skipLabels: 'Skip-Changelog' - \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 87715df..1b1841d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,16 +13,15 @@ name: "CodeQL" on: push: - branches: [ master, development, patch/*, release/*, hotfix/* ] + branches: [ main, master, development, release/*, hotfix/* ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ main, master ] schedule: - cron: '21 1 * * 4' jobs: analyze: - name: Analyze runs-on: ubuntu-latest permissions: actions: read @@ -37,47 +36,48 @@ jobs: # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - settings-path: ${{ github.workspace }} + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '8' + settings-path: ${{ github.workspace }} - - name: Load local Maven repository cache - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + - name: Load local Maven repository cache + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..ed38abf --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,98 @@ +name: Create Release + +on: + workflow_dispatch: + inputs: + versionTag: + description: 'Version Tag (semantic version)' + required: true + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '8' + settings-path: ${{ github.workspace }} + + - name: Load local Maven repository cache + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Set up git + run: | + git config --global user.email "support@qbic.zendesk.com" + git config --global user.name "JohnnyQ5" + + - name: Set version in Maven project + run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }} + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Create Release Notes + if: ${{ !startsWith(github.ref, 'refs/tags/') + && !( contains(github.event.inputs.versionTag, 'alpha') + || contains(github.event.inputs.versionTag, 'beta') + || contains(github.event.inputs.versionTag, 'rc')) }} + uses: actions/github-script@v6 + with: + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: "${{ github.event.inputs.versionTag }}", + generate_release_notes: true + }); + + - name: Create Pre-Release Notes + if: ${{ !startsWith(github.ref, 'refs/tags/') + && ( contains(github.event.inputs.versionTag, 'alpha') + || contains(github.event.inputs.versionTag, 'beta') + || contains(github.event.inputs.versionTag, 'rc')) }} + uses: actions/github-script@v6 + with: + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: "${{ github.event.inputs.versionTag }}", + generate_release_notes: true, + prerelease: true + }); + + - name: Publish artefact to QBiC Nexus Repository + run: mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml deploy + env: + MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }} + MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + - name: Switch to new branch + run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }} + + - name: Set remote branch + run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }} + + - name: Checkin commit + run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}' + + - name: Push to Github + run: git push + + - name: Open PR with version bump + uses: actions/github-script@v6 + with: + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} + script: | + await github.request(`POST /repos/${{ github.repository }}/pulls`, { + title: 'Update version to ${{ github.event.inputs.versionTag }}', + head: 'release/set-version-to-${{ github.event.inputs.versionTag }}', + base: 'main' + }); diff --git a/.github/workflows/generate-reports.yml b/.github/workflows/generate-reports.yml deleted file mode 100644 index f1f02bb..0000000 --- a/.github/workflows/generate-reports.yml +++ /dev/null @@ -1,61 +0,0 @@ -# This workflow will generate surefire reports and API documentation with Maven and publish -# them on the 'gh-pages' branch of the target Github repository. - -name: Generate reports and API documentation - -on: - release: - types: [created] - push: - branches: - - development - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Install git - run: sudo apt-get install git - - - name: Set up JDK 1.11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} - - - name: Setup Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pygithub - - - name: Load local Maven repository cache - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: Maven generate reports - run: mvn --activate-profiles !development-build,!release-build --settings .github.settings.xml site - - - name: Set up git - run: | - git config --global user.email "support@qbic.zendesk.com" - git config --global user.name "JohnnyQ5" - - - name: Publish reports - run: | - python .generate-reports.py ${GITHUB_REF##*/} $GITHUB_REPOSITORY "[Github Action] Updated gh-pages" - env: - REPORTS_GITHUB_ACCESS_TOKEN: ${{ secrets.JOHNNY_Q5_REPORTS_TOKEN }} diff --git a/.github/workflows/groovy_checkstyle.yml b/.github/workflows/groovy_checkstyle.yml deleted file mode 100644 index ea3df6a..0000000 --- a/.github/workflows/groovy_checkstyle.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Groovy Checkstyle - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: setup Node 12 - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - - name: Install npm-groovy-lint - run: npm install -g npm-groovy-lint - - - name: Run npm-groovy-lint - run: npm-groovy-lint diff --git a/.github/workflows/label-pull-requests.yml b/.github/workflows/label-pull-requests.yml new file mode 100644 index 0000000..931ff6d --- /dev/null +++ b/.github/workflows/label-pull-requests.yml @@ -0,0 +1,17 @@ +name: Label Pull Requests + +permissions: + contents: read + pull-requests: write + +on: + pull_request: + types: [ opened, edited ] + +jobs: + Assign-Label-To-Pull-Request: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5.0.0-alpha.1 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/nexus-publish-release.yml b/.github/workflows/nexus-publish-release.yml deleted file mode 100644 index 7475117..0000000 --- a/.github/workflows/nexus-publish-release.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This workflow will build a package using Maven and then publish it to -# qbic-repo.qbic.uni-tuebingen.de packages when a release is created -# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path - -name: Nexus Package - -on: - release: - types: [created] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} - - - name: Load local Maven repository cache - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: Remove snapshot tags - run: mvn versions:set -DremoveSnapshot - - - name: Build with Maven - run: mvn -B package --file pom.xml - - - name: Publish artefact to QBiC Nexus Repository - run: mvn --quiet --activate-profiles !development-build,release-build --settings $GITHUB_WORKSPACE/.github.settings.xml deploy - env: - MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }} - MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} diff --git a/.github/workflows/nexus-publish.yml b/.github/workflows/nexus-publish-snapshots.yml similarity index 61% rename from .github/workflows/nexus-publish.yml rename to .github/workflows/nexus-publish-snapshots.yml index be8c619..9d98c35 100644 --- a/.github/workflows/nexus-publish.yml +++ b/.github/workflows/nexus-publish-snapshots.yml @@ -2,7 +2,7 @@ # qbic-repo.qbic.uni-tuebingen.de packages when a release is created # For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path -name: Nexus Package +name: Deploy Snapshot on: push: @@ -10,25 +10,33 @@ on: - development jobs: - build: + publish_snapshot: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 with: - java-version: 1.8 + distribution: 'zulu' + java-version: '8' settings-path: ${{ github.workspace }} - + - name: Load local Maven repository cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + # Remove existing snapshot tags which are not supposed to be present + - name: Remove snapshot tags + run: mvn versions:set -DremoveSnapshot + # Set the SNAPSHOT for this build and deployment + - name: Set version in Maven project + run: mvn versions:set -DnewVersion='${project.version}-SNAPSHOT' - name: Build with Maven run: mvn -B package --file pom.xml @@ -38,4 +46,3 @@ jobs: env: MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }} MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - diff --git a/.github/workflows/pr_to_master_from_hotfix_release_only.yml b/.github/workflows/pr_to_master_from_hotfix_release_only.yml deleted file mode 100644 index 41b9ee5..0000000 --- a/.github/workflows/pr_to_master_from_hotfix_release_only.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PR to master branch from patch/release branch only - -on: - pull_request: - branches: - - master - -jobs: - test: - runs-on: ubuntu-latest - steps: - # PRs to the repository master branch are only ok if coming from any patch or release branch - - name: Check PRs - run: | - { [[ $GITHUB_HEAD_REF = *"release"* ]]; } || [[ $GITHUB_HEAD_REF == *"hotfix"* ]] - - - # If the above check failed, post a comment on the PR explaining the failure - # NOTE - this may not work if the PR is coming from a fork, due to limitations in GitHub actions secrets - - name: Post PR comment - if: failure() - uses: mshick/add-pr-comment@v1 - with: - message: | - Hi @${{ github.event.pull_request.user.login }}, - - It looks like this pull-request is has been made against the ${{github.event.pull_request.head.repo.full_name}} `master` branch. - The `master` branch should always contain code from the latest release. - Because of this, PRs to `master` are only allowed if they come from any ${{github.event.pull_request.head.repo.full_name}} `release` or `hotfix` branch. - - You do not need to close this PR, you can change the target branch to `development` by clicking the _"Edit"_ button at the top of this page. - - Thanks again for your contribution! - repo-token: ${{ secrets.GITHUB_TOKEN }} - allow-repeats: false - diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index c9660cc..a5e3281 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -1,20 +1,29 @@ name: Run Maven Tests -on: [push] +on: + push: + branches: + - '**' + pull_request: + # The branches below must be a subset of the branches above + branches: [ main, master ] jobs: - build: + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 with: - java-version: 1.8 + distribution: 'zulu' + java-version: '8' + settings-path: ${{ github.workspace }} - name: Load local Maven repository cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}