Skip to content

Commit

Permalink
Merge branch 'main' into dhlevi_api-model
Browse files Browse the repository at this point in the history
  • Loading branch information
ssylver93 authored Nov 26, 2024
2 parents a7b894d + a35189b commit b9ded32
Show file tree
Hide file tree
Showing 69 changed files with 11,748 additions and 423 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/build-full-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ on:
description: Additional tag to add to built images

jobs:

wfprev-ui:
uses: ./.github/workflows/mvn-build.yml
secrets: inherit
with:
COMPONENT_NAME: wfprev-war
TAG: latest
COMPONENT_TYPE: client

wfprev-api:
uses: ./.github/workflows/mvn-build.yml
secrets: inherit
Expand All @@ -42,17 +49,8 @@ jobs:

terragrunt-deploy-dev:
uses: ./.github/workflows/terragrunt-deploy.yml
needs: [wfprev-api, liquibase-build]
with:
DEFAULT_APPLICATION_ENVIRONMENT: dev
IMAGE_TAG: latest
secrets: inherit

wfprev-ui:
uses: ./.github/workflows/client-build.yml
needs: [terragrunt-deploy-dev]
needs: [wfprev-ui, wfprev-api, liquibase-build]
with:
DEFAULT_APPLICATION_ENVIRONMENT: dev
IMAGE_TAG: latest
secrets: inherit

85 changes: 0 additions & 85 deletions .github/workflows/client-build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/liquibase-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3

- id: trimBranchName
name: trim branch name if necessary
Expand Down
102 changes: 56 additions & 46 deletions .github/workflows/mvn-build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
env:

IMAGE_NAME: "${{ github.repository }}-${{inputs.COMPONENT_NAME}}"
NPMRC: ${{ secrets.NPMRC }}

permissions:
contents: read
packages: write

# Controls when the workflow will run
on:
workflow_dispatch:
inputs:
Expand All @@ -22,7 +20,7 @@ on:
COMPONENT_TYPE:
required: true
type: choice
options:
options:
- server
- libs
workflow_call:
Expand All @@ -45,50 +43,71 @@ jobs:
steps:
- uses: actions/checkout@v4
if: ${{ inputs.IS_HOTFIX != 'true' }}

- uses: actions/checkout@v4
if: ${{ inputs.IS_HOTFIX == 'true' }}
with:
ref: ${{ inputs.BRANCH }}

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
- name: Setup Maven
uses: actions/setup-java@v4
with:
node-version: '20.x'
distribution: 'temurin'
java-version: '21'
cache: 'maven'

- name: Set up JDK 21
uses: actions/setup-java@v4
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'temurin'

distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
components: 'native-image'

- name: Add .npmrc file
run: echo -e $NPMRC > ~/.npmrc
- name: Build API with Maven

- name: Build Native Image with Maven
if: ${{ inputs.COMPONENT_TYPE == 'server' }}
run: |
export MAVEN_OPTS="-Xmx3072m -XX:MaxMetaspaceSize=512m"
export NODE_OPTIONS="--max-old-space-size=4096"
mvn --settings ${{ inputs.COMPONENT_TYPE }}/${{ inputs.COMPONENT_NAME }}/mvn_settings/settings.xml --batch-mode --update-snapshots -f ${{ inputs.COMPONENT_TYPE }}/${{ inputs.COMPONENT_NAME }}/pom.xml -Drepo.login=${{ secrets.IDIR_AS_EMAIL }} -Drepo.password=${{ secrets.IDIR_PASSWORD }} -DskipTests package
- name: Copy files to neccessary folders
set -x
export MAVEN_OPTS="-Xmx6g -XX:MaxMetaspaceSize=1g"
export NATIVE_IMAGE_OPTS="-Xmx8g"
cd ${{ inputs.COMPONENT_TYPE }}/${{ inputs.COMPONENT_NAME }}
# Use absolute path to settings.xml
settings_file="$(pwd)/mvn_settings/settings.xml"
echo "Looking for settings file at: $settings_file"
# Check if file exists and is readable
if [ ! -f "$settings_file" ]; then
echo "ERROR: $settings_file not found!"
ls -la mvn_settings/
exit 1
fi
if [ ! -r "$settings_file" ]; then
echo "ERROR: $settings_file not readable!"
ls -la "$settings_file"
exit 1
fi
echo "Using settings file: $settings_file"
mvn -s "$settings_file" --batch-mode -Pnative native:compile -DskipTests -Drepo.login=${{ secrets.IDIR_AS_EMAIL }} -Drepo.password=${{ secrets.IDIR_PASSWORD }}
- name: Copy native binary to staging
if: ${{ inputs.COMPONENT_TYPE == 'server' }}
run: mkdir staging && cp ${{ inputs.COMPONENT_TYPE }}/${{ inputs.COMPONENT_NAME }}/target/*.war staging

run: |
mkdir -p staging
cp ${{ inputs.COMPONENT_TYPE }}/${{ inputs.COMPONENT_NAME }}/target/wfprev-api staging/
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.COMPONENT_NAME }}-package
path: staging

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: staging
key: ${{ inputs.COMPONENT_NAME }}-maven-${{ hashFiles('**war.xml') }}
restore-keys: |
${{ inputs.COMPONENT_NAME }}-maven-
docker:
needs: build
runs-on: ubuntu-latest
Expand All @@ -107,21 +126,12 @@ jobs:
trimTag="${branchTag##*/}"
echo "BRANCH_TAG=$trimTag" >> $GITHUB_OUTPUT
# - uses: actions/checkout@v4
# if: ${{ github.event.inputs.IS_HOTFIX == 'true' }}
# with:
# ref: ${{ inputs.BRANCH }}

- name: download server artifact
- name: download native binary
uses: actions/download-artifact@v3
with:
name: ${{ inputs.COMPONENT_NAME }}-package
path: ${{inputs.COMPONENT_TYPE}}/${{inputs.COMPONENT_NAME}}

# - name: Update image name if PR number present
# if: ${{ github.event.pull_request.number > 0 || inputs.IS_HOTFIX == 'true' }}
# run: echo "IMAGE_NAME = ${{env.IMAGE_NAME}}-${{ inputs.IS_HOTFIX == 'true' && 'hotfix' || github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand All @@ -135,8 +145,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN}}

- name: Extract metadata (tags, labels) for Docker (with PR)
# if: ${{ github.event.pull_request.number > 0 || inputs.IS_HOTFIX == 'true' }}
- name: Extract metadata for Docker
id: meta_pr
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
Expand All @@ -150,9 +159,10 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ${{inputs.COMPONENT_TYPE}}/${{inputs.COMPONENT_NAME}}
build-args: |
CONTAINER_NAME=${{inputs.COMPONENT_NAME}}
push: true
tags: ${{ steps.meta_pr.outputs.tags }}
labels: ${{ steps.meta_pr.outputs.labels }}
context: ${{inputs.COMPONENT_TYPE}}/${{inputs.COMPONENT_NAME}}
build-args: |
CONTAINER_NAME=${{inputs.COMPONENT_NAME}}
MAVEN_SETTINGS_FILE=settings.xml
push: true
tags: ${{ steps.meta_pr.outputs.tags }}
labels: ${{ steps.meta_pr.outputs.labels }}
26 changes: 22 additions & 4 deletions .github/workflows/sonarscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ env:
MAVEN_OPTS: "-Xmx10000m"
NODE_OPTIONS: "--max-old-space-size=4096"
on:
push:
branches: [ main, feature/* ]
pull_request_target:
# push:
# branches: [ main, feature/* ]
pull_request:
branches: [ main, feature/* ]
types: [opened, synchronize, reopened]
jobs:
Expand All @@ -20,6 +20,18 @@ jobs:
with:
fetch-depth: 0
submodules: 'recursive'
ref: ${{ github.head_ref }}

- name: Debug checkout info
run: |
echo "Current branch: ${{ github.ref_name }}"
echo "Commit SHA: ${{ github.sha }}"
echo "Current directory contents:"
cd ./client/wfprev-war/src/main/angular
echo "Angular directory contents:"
ls -la
echo "Test file contents:"
cat src/app/components/list/list.component.spec.ts
- name: Set up JDK 21
uses: actions/setup-java@v4
Expand All @@ -41,12 +53,18 @@ jobs:
cache: 'yarn'
cache-dependency-path: './client/wfprev-war/src/main/angular/yarn.lock'

- name: Clear cache
working-directory: ./client/wfprev-war/src/main/angular
run: |
rm -rf node_modules
yarn cache clean
- name: Install dependencies and Angular CLI
working-directory: ./client/wfprev-war/src/main/angular
run: |
yarn install
yarn global add @angular/cli
- name: Run client tests with coverage
working-directory: ./client/wfprev-war/src/main/angular
run: $(yarn global bin)/ng test --no-watch --code-coverage
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/terragrunt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
contents: read # This is required for actions/checkout

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
# - name: retrieve lambda artifacts
# uses: actions/download-artifact@v3
# with:
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
echo "IMAGE_UI_BY_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' $IMAGE)" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_TERRAFORM_ROLE_TO_ASSUME }}
role-session-name: wfprev-terraform-s3
Expand All @@ -114,6 +114,7 @@ jobs:
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}
cli_config_credentials_token: ${{ secrets.TFC_TEAM_TOKEN }}

- uses: peter-murray/[email protected]
with:
Expand Down Expand Up @@ -148,6 +149,8 @@ jobs:
# WFPREV UI
CLIENT_IMAGE: ${{ steps.getDigestUI.outputs.IMAGE_UI_BY_DIGEST }}
WEBADE_OAUTH2_WFPREV_UI_CLIENT_SECRET: ${{ secrets.WEBADE_OAUTH2_WFPREV_UI_CLIENT_SECRET }}
WFPREV_CLIENT_MEMORY: ${{vars.WFPREV_CLIENT_MEMORY}}
WFPREV_CLIENT_CPU_UNITS : ${{vars.WFPREV_CLIENT_CPU_UNITS}}

# DB
WFPREV_USERNAME: ${{secrets.WFPREV_USERNAME}}
Expand Down
Loading

0 comments on commit b9ded32

Please sign in to comment.