ci-native #238
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: ci-native | |
on: | |
push: | |
branches: [master] | |
paths: | |
- ".github/workflows/ci-native.yml" | |
- "src/**" | |
- "config/**" | |
- "liquibase/**" | |
- "docker-compose.yaml" | |
- "pom.xml" | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: "15 1 * * 1" | |
permissions: | |
packages: write | |
concurrency: | |
group: ci-native | |
jobs: | |
test-native: | |
runs-on: ubuntu-latest | |
env: | |
MVN: mvn --show-version --batch-mode | |
steps: | |
- name: java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "adopt" | |
- name: graalvm | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: 17 | |
distribution: mandrel | |
version: mandrel-23.0.1.2-Final | |
- name: login registry.redhat.io | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.redhat.io | |
username: ${{ secrets.REDHAT_USR }} | |
password: ${{ secrets.REDHAT_PWD }} | |
logout: true | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: cache ~/.m2 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: docker compose version | |
run: docker compose version | |
- name: docker compose up keycloak postgresql | |
run: | | |
docker compose up --detach keycloak postgresql | |
sleep 15 | |
- name: docker compose run liquibase | |
run: docker compose run --rm liquibase | |
- name: mvn clean verify -Pnative | |
run: $MVN clean verify -Pnative | |
# Image push happens before native tests when running 'mvn clean verify -Pnative -Dquarkus.container-image.push=true', so decided to split. | |
build-native: | |
if: github.ref == 'refs/heads/master' | |
needs: test-native | |
runs-on: ubuntu-latest | |
env: | |
MVN: mvn --show-version --batch-mode | |
steps: | |
- name: JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "adopt" | |
- name: login registry.redhat.io | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.redhat.io | |
username: ${{ secrets.REDHAT_USR }} | |
password: ${{ secrets.REDHAT_PWD }} | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: cache ~/.m2 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: mvn package -Pnative -DskipTests -Dquarkus.native.container-build=true -Dquarkus.container-image.push=true | |
run: >- | |
$MVN package -Pnative -DskipTests | |
-Dquarkus.native.container-build=true | |
-Dquarkus.container-image.push=true | |
-Dquarkus.container-image.username=${{ github.actor }} | |
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }} | |
-Dquarkus.container-image.image=ghcr.io/${{ github.repository_owner }}/quarkus-native:latest | |
'-Dquarkus.container-image.labels."org.opencontainers.image.revision"='$GITHUB_SHA |