Fix unit-tests #18
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 | |
#env: | |
# JDK_JAVA_OPTIONS: --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED | |
# MAVEN_USERNAME: ch4mpy | |
on: [push] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Make Maven Wrapper executable | |
if: contains(matrix.os, 'win') == false | |
run: chmod +x ./api/mvnw | |
- name: Build with Maven | |
run: | | |
cd ./api | |
./mvnw clean install -Popenapi,h2 | |
./mvnw spring-boot:build-image -DskipTests | |
- name: Set VERSION environment variable | |
run: | | |
cd ./api | |
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Tag-Push gateway ${{ env.VERSION }} | |
run: | | |
docker tag bff:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/quiz-bff | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/quiz-bff | |
- name: Docker Tag-Push API ${{ env.VERSION }} | |
run: | | |
docker tag quiz-api:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/quiz-api | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/quiz-api | |
- name: Docker Build-Tag-Push Angular UI | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./angular-ui | |
file: ./angular-ui/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/quiz-ui | |
- name: Rollout Restart OVH quiz | |
run: | | |
mkdir ${HOME}/.kube | |
echo ${{ secrets.OVH_KUBECONFIG }} | base64 --decode > ${HOME}/.kube/config | |
kubectl config use-context kubernetes-admin@c4-staging | |
kubectl rollout restart -n quiz deployment.apps/quiz-ui deployment.apps/bff deployment.apps/quiz-api |