diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9867ba9..9f5ca1e 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,24 +1,31 @@ -name: Build +name: Build [PR and non-mainline branches] on: + pull_request: + branches: main push: branches: - - main - - main_** - - features/** + - '!main' + - 'feature/**' jobs: build: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + + - uses: actions/checkout@v4 + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + ref: ${{ github.head_ref }} - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 21 + distribution: 'temurin' + cache: 'maven' - name: Branch name run: echo running on branch ${GITHUB_REF#refs/heads/} @@ -30,13 +37,29 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and Test env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any run: mvn clean install - name: Analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=sddevelopment_coding-utils + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=sddevelopment-be_coding-utils + + - name: Commit JavaDocs + uses: stefanzweifel/git-auto-commit-action@v5 + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any + with: + file_pattern: 'docs/*' + commit_message: 'Update documentation' + disable_globbing: true \ No newline at end of file diff --git a/.github/workflows/build_mainline.yml b/.github/workflows/build_mainline.yml new file mode 100755 index 0000000..f377b11 --- /dev/null +++ b/.github/workflows/build_mainline.yml @@ -0,0 +1,48 @@ +name: Build [mainline] +on: + push: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + permissions: + contents: write + pages: write + + steps: + - uses: actions/checkout@v4 + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any + with: + ref: ${{ github.head_ref }} + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: 'temurin' + cache: 'maven' + + - name: Branch name + run: echo running on branch ${GITHUB_REF#refs/heads/} + + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build and Test + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any + run: mvn clean install + + - name: Analyze + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=sddevelopment-be_coding-utils diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100755 index e69de29..0000000 diff --git a/.github/workflows/rebuildDocs.sh b/.github/workflows/rebuildDocs.sh deleted file mode 120000 index 7658444..0000000 --- a/.github/workflows/rebuildDocs.sh +++ /dev/null @@ -1 +0,0 @@ -../../scripts/rebuildDocs.sh \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9471031..1cbed63 100755 --- a/pom.xml +++ b/pom.xml @@ -112,13 +112,26 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + 3.13.0 ${java.version} ${java.version} + + org.apache.maven.plugins + maven-javadoc-plugin + 3.5.0 + + maven + src/main/javadoc + + /styles/stylesheet.css + + + + org.projectlombok lombok-maven-plugin