Pondering Predictor #69
This file contains 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: Test and Build | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
java_version: [ 17, 21 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK ${{ matrix.java_version }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java_version }} | |
distribution: 'temurin' | |
- name: Run Maven tests | |
run: mvn test --no-transfer-progress --file pom.xml | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Set outputs | |
id: vars | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: commonworkflowscheduler | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
logout: true | |
tags: commonworkflowscheduler/kubernetesscheduler:${{ steps.vars.outputs.sha_short }}, commonworkflowscheduler/kubernetesscheduler:latest, commonworkflowscheduler/kubernetesscheduler:${{ steps.vars.outputs.version }} |