Update tools and librairies versions #405
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: REST Server - Continuous Integration | |
### | |
# Continuous integration GitHub Action | |
# | |
# -> Push your code to the `main` branch to have it automatically tested | |
# | |
### | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'rest-server/**' | |
- '.github/workflows/rest-server-continuous-integration.yml' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'rest-server/**' | |
- '.github/workflows/rest-server-continuous-integration.yml' | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }}/rest-server | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '20' | |
check-latest: false | |
cache: 'maven' | |
- name: Run tests | |
run: mvn verify | |
build_java_docker_image: | |
name: Build and publish the JVM-based Docker image | |
needs: [ test ] | |
runs-on: ubuntu-22.04 | |
env: | |
DOCKER_IMAGE_NAME: 'ghcr.io/microsoft/nubesgen/nubesgen' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Packages | |
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '20' | |
check-latest: false | |
cache: 'maven' | |
- name: Build application with Java | |
run: | | |
cd rest-server && mvn package && mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar) | |
- name: Build the JVM-based Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
tags: ${{ env.DOCKER_IMAGE_NAME }}:main | |
file: ./rest-server/src/main/docker/Dockerfile.jvm | |
context: ./rest-server/ | |
- name: Push to GitHub Packages | |
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:main | |
if: ${{ github.repository == 'microsoft/nubesgen' && github.event_name != 'pull_request' }} | |
build_native_docker_image: | |
name: Build and publish the native (Linux) Docker image | |
needs: [ test ] | |
runs-on: ubuntu-22.04 | |
env: | |
DOCKER_IMAGE_NAME: 'ghcr.io/microsoft/nubesgen/nubesgen-native' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Packages | |
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: 'graalvm' | |
java-version: '17' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache: 'maven' | |
- name: Build application with GraalVM | |
run: | | |
cd rest-server && mvn -Pnative native:compile | |
- name: Build the native (GraalVM) Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
tags: ${{ env.DOCKER_IMAGE_NAME }}:main | |
file: ./rest-server/src/main/docker/Dockerfile.native | |
context: ./rest-server/ | |
- name: Push to GitHub Packages | |
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:main | |
if: ${{ github.repository == 'microsoft/nubesgen' && github.event_name != 'pull_request' }} |