Skip to content

CI

CI #671

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches: [main, '+.x', next, next-major, beta, alpha]
pull_request:
branches: [main, '+.x', next, next-major, beta, alpha]
schedule:
- cron: '5 4 * * *' # Every day at 04:05
permissions: {}
env:
MAVEN_ARGS: --batch-mode -Dstyle.color=always
jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
security-events: write # Required by SonarCloud for reporting found security vulnerabilities
steps:
- name: Harden runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
api.github.com:443
objects.githubusercontent.com:443
repo.maven.apache.org:443
jitpack.io:443
repo.papermc.io:443
api.nuget.org:443
registry.npmjs.org:443
auth.docker.io:443
registry-1.docker.io:443
production.cloudflare.docker.com:443
sonarcloud.io:443
scanner.sonarcloud.io:443
ea6ne4j2sb.execute-api.eu-central-1.amazonaws.com:443
sc-cleancode-sensorcache-eu-central-1-prod.s3.amazonaws.com:443
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
fetch-depth: 0 # Required by SonarCloud
- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: 21
distribution: temurin
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.sonar/cache
key: sonar
restore-keys: sonar
- name: Maven build & SonarCloud quality scan
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
run: |
SONAR_ORGANIZATION="$(echo '${{ github.repository_owner }}' | awk '{print tolower($0)}')"
SONAR_PROJECT_KEY="$(echo '${{ github.repository }}' | sed 's/\//_/')"
./mvnw verify sonar:sonar \
-Dsonar.host.url="${SONAR_HOST_URL}" \
-Dsonar.organization="${SONAR_ORGANIZATION}" \
-Dsonar.projectKey="${SONAR_PROJECT_KEY}"
codeql-sast:
name: CodeQL - Static Application Security Testing (SAST)
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
actions: read
contents: read
security-events: write # Required for reporting found security vulnerabilities
steps:
- name: Harden runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
api.github.com:443
uploads.github.com:443
objects.githubusercontent.com
repo.maven.apache.org:443
jitpack.io:443
repo.papermc.io:443
api.nuget.org:443
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
with:
java-version: 21
distribution: temurin
cache: maven
- name: Initialize CodeQL
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
languages: java
- name: Build
run: ./mvnw package -DskipTests
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
category: /language:java