Build, run tests, package and deploy #457
Workflow file for this run
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" | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ 'ubuntu-latest', 'macos-latest' ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: maven | |
| # Build all modules except klass-forvaltning since it is not compatible with JDK 17 | |
| - name: Build, test and package with Maven | |
| run: mvn --batch-mode --update-snapshots package -pl '!:klass-forvaltning' | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 1.8 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '8' | |
| cache: maven | |
| # Build only klass-forvaltning with JDK 1.8 | |
| - name: Build, test and package with Maven | |
| run: mvn --batch-mode --update-snapshots package -Djava.version=1.8 -pl :klass-forvaltning -am | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name != 'pull_request' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: maven | |
| - name: Publish to GitHub Packages | |
| run: mvn --batch-mode deploy -pl '!:klass-forvaltning' -DskipTests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |