Skip to content

Commit

Permalink
fix git workflows
Browse files Browse the repository at this point in the history
- use latest maven
- use same jdk distribution
- use same nodejs
- use same maven cache from setup-java action
  • Loading branch information
sephiroth-j committed Nov 28, 2024
1 parent 7cf6669 commit 36b415c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [11,17,21]
steps:
Expand All @@ -24,6 +25,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9
- name: check Sonar pre-conditions
id: check_sonar
continue-on-error: true
Expand All @@ -34,15 +39,15 @@ jobs:
shell: bash
- name: Build with Sonar
id: build_sonar
if: matrix.java == '17' && steps.check_sonar.outcome == 'success' && !startsWith(github.head_ref, 'dependabot/')
if: matrix.java == 17 && steps.check_sonar.outcome == 'success' && !startsWith(github.head_ref, 'dependabot/')
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
SONAR_ORGANIZATION: ${{ secrets.SONARCLOUD_ORGANIZATION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B clean test verify package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=org.jenkins-ci.plugins:dependency-track -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.token=$SONAR_TOKEN
run: mvn -B -T 1C verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=org.jenkins-ci.plugins:dependency-track -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.token=$SONAR_TOKEN
- name: Build without Sonar
if: steps.build_sonar.conclusion == 'skipped'
run: mvn -B clean test verify package
run: mvn -B -T 1C verify
- name: Sonar Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
Expand All @@ -53,7 +58,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
SONAR_ORGANIZATION: ${{ secrets.SONARCLOUD_ORGANIZATION }}
- uses: actions/upload-artifact@v4
if: matrix.java == '11' && success()
if: matrix.java == 11 && success()
with:
path: target/dependency-track.hpi
name: dependency-track.hpi
16 changes: 10 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ jobs:
if: matrix.language == 'java'
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
distribution: 'zulu'
cache: 'maven'

- name: Cache Maven packages
uses: actions/cache@v4
- name: Set up Maven
uses: stCarolas/setup-maven@v5
if: matrix.language == 'java'
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
maven-version: 3.9.9

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
with:
node-version: 'lts/*'

- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.9

- name: Configure Git User
run: |
git config user.name "github-actions[bot]"
Expand Down

0 comments on commit 36b415c

Please sign in to comment.