Build, run tests, package and deploy #1085
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| run-name: "Build, run tests, package and deploy" | |
| permissions: | |
| contents: read | |
| packages: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| - klass-forvaltning | |
| - klass-solr | |
| jobs: | |
| check-code-format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: '0' | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: maven | |
| - name: Check code format | |
| run: mvn --batch-mode fmt:check | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: maven | |
| - name: Build and test | |
| run: mvn --batch-mode --update-snapshots package | |
| - name: SonarQube Cloud Scan | |
| # No need to run SonarCloud analysis if dependabot update or token not defined | |
| if: env.SONAR_TOKEN != '' && (github.actor != 'dependabot[bot]') | |
| run: mvn --batch-mode sonar:sonar | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |