Merge pull request #2008 from Heigvd/MIM-132-fix-language-bug #998
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: CI | |
on: | |
pull_request: | |
branches: | |
- master | |
- dev | |
push: | |
branches: | |
- master | |
- dev | |
tags: | |
- "v*" | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: user | |
POSTGRES_PASSWORD: 1234 | |
POSTGRES_DB: wegas_test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{secrets.WEGAS_CI_BUILD_KEY}} | |
submodules: recursive | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/iron | |
cache: yarn | |
cache-dependency-path: | | |
wegas-runtime/src/test/node/yarn.lock | |
wegas-app/yarn.lock | |
wegas-ts-api/yarn.lock | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: maven | |
- name: Guess branch name | |
id: branch-name | |
shell: bash | |
run: | | |
echo "MAVEN_OPTS='-Xms800m -Xmx800m'" > ~/.mavenrc | |
echo "BRANCH=$(if [ ${{ github.event_name }} == pull_request ]; then echo ${{ github.base_ref }}; else echo ${{ github.ref_name}}; fi)" >> $GITHUB_OUTPUT | |
- name: Set war name | |
id: war-name | |
shell: bash | |
run: echo "WAR_NAME=Wegas_$(if [ ${{ github.event_name }} == pull_request ]; then echo ${{ github.event.number }}_${{ github.head_ref }} ; else echo ${{steps.branch-name.outputs.BRANCH}}; fi)_${GITHUB_RUN_NUMBER}.war" >> $GITHUB_OUTPUT | |
- name: Patch wegas properties | |
shell: bash | |
env: | |
PR_NAME: ${{ github.head_ref }} | |
PR_NUMBER: ${{ github.event.number}} | |
run: perl -pi -e 's/(wegas.build.number)=/$1=$ENV{GITHUB_RUN_NUMBER}/;s~(wegas.build.branch)=~$1=${{steps.branch-name.outputs.BRANCH}}~;s/(wegas.build.pr_branch)=/$1=$ENV{PR_NAME}/;s/(wegas.build.pr_number)=/$1=$ENV{PR_NUMBER}/;' wegas-core/src/main/resources/wegas.properties | |
- name: Build with Maven | |
run: mvn -B -P release-profile package --file pom.xml | |
- name: export cypress failures to filebin.net | |
if: ${{ failure() }} | |
shell: bash | |
run: wegas-runtime/src/test/node/upload_result.sh | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
if: github.event_name != 'pull_request' | |
id: docker-meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push docker image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v5 | |
with: | |
context: wegas-runtime/src/main/docker/wegas | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x | |
push: true | |
tags: ${{ steps.docker-meta.outputs.tags }} | |
labels: ${{ steps.docker-meta.outputs.labels }} | |
# - name: clean maven cache | |
# shell: bash | |
# run: ./clean_repository.sh |