Skip to content

Commit

Permalink
Merge branch '3.6.0.release'
Browse files Browse the repository at this point in the history
  • Loading branch information
vlo-rte committed Apr 4, 2022
2 parents 686be57 + b4cf3d0 commit 7870ce1
Show file tree
Hide file tree
Showing 373 changed files with 7,039 additions and 4,129 deletions.
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- In release note :
- In chapter : Features Bugs Tasks
- Text : #xxx ...
2 changes: 1 addition & 1 deletion .github/workflows/anchore-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Pull docker images
run: |
docker pull lfeoperatorfabric/of-cards-consultation-business-service:SNAPSHOT
Expand Down
133 changes: 18 additions & 115 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
name: CI

on:
# Triggers the workflow on push
push:
branches:
- develop
- master
- '**release'
- '**hotfixes'
pull_request:
schedule:
# launch a build every day on develop
Expand All @@ -29,6 +23,10 @@ on:
description: 'Cypress Tests'
required: false
default: 'true'
cypressTestFiles:
description: 'Cypress Test files'
required: false
default: '*'
doc:
description: 'Build and publish documentation '
required: false
Expand All @@ -50,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.dockerPush != 'true' && github.event.inputs.dockerPushLatest != 'true' && github.event.inputs.doc != 'true' && github.event.inputs.docLatest != 'true' && github.event_name != 'schedule' && github.ref_name != 'master' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Job status
run: |
Expand All @@ -63,7 +61,7 @@ jobs:
echo "Opfab Version : ${OF_VERSION}"
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -73,34 +71,13 @@ jobs:

# Install all required tools
- name: Install
run: |
curl -s "https://get.sdkman.io" | bash ;
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config ;
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config ;
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
sudo apt-get install jq
git config --global user.email "opfabtech@gmail.com"
git config --global user.name "OpfabTech"
run: ./CICD/github/install.sh

- name: Build
if: ${{ github.event.inputs.build == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push'}}
# set variable in this step (sdk, nvm et gradle)
# build.sh set variable for sdk, nvm and gradle
# if variable is set in install step it is not accessible in this step
run: |
export OF_VERSION=$(<VERSION)
docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
echo "npm version $(npm -version)"
echo "node version $(node --version)"
sdk version
javac -version
./gradlew --version
./gradlew --build-cache copyDependencies test jacocoTestReport sonarqube dockerTag${OF_VERSION}
docker-compose -f src/main/docker/test-environment/docker-compose.yml down
run: ./CICD/github/build.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
Expand All @@ -109,45 +86,19 @@ jobs:

- name: Karate tests
if: ${{ github.event.inputs.karate == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
cd config/docker
./docker-compose.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../src/test/api/karate
./launchAll.sh
cd ../../../../config/docker
docker-compose down --remove-orphans
run: ./CICD/github/launch_karate_tests.sh

- name: Cypress tests
if: ${{ github.event.inputs.cypress == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
cd config/docker
./docker-compose-cypress.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../
./gradlew runCypressTests
cd config/docker
docker-compose down
run: ./CICD/github/launch_cypress_tests.sh ${{ github.event.inputs.cypressTestFiles }}


publish:
runs-on: ubuntu-latest
environment: publishVersion
if: ${{ github.event.inputs.dockerPush == 'true' || github.event.inputs.dockerPushLatest == 'true' || github.event.inputs.doc == 'true' || github.event.inputs.docLatest == 'true' || github.event_name == 'schedule' || github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Job status
run: |
Expand All @@ -160,7 +111,7 @@ jobs:
echo "Opfab Version : ${OF_VERSION}"
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -170,73 +121,25 @@ jobs:

# Install all required tools
- name: Install
run: |
curl -s "https://get.sdkman.io" | bash ;
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config ;
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config ;
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
sudo apt-get install jq
git config --global user.email "opfabtech@gmail.com"
git config --global user.name "OpfabTech"
run: ./CICD/github/install.sh

- name: Build
if: ${{ github.event.inputs.build == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push'}}
# set variable in this step (sdk, nvm et gradle)
# if variable is set in install step it is not accessible in this step
run: |
export OF_VERSION=$(<VERSION)
echo ${{ secrets.DOCKER_TOKEN }} | docker login --username opfabtravis --password-stdin
docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
echo "npm version $(npm -version)"
echo "node version $(node --version)"
sdk version
javac -version
./gradlew --version
./gradlew --build-cache copyDependencies test jacocoTestReport sonarqube dockerTag${OF_VERSION}
docker-compose -f src/main/docker/test-environment/docker-compose.yml down
run: ./CICD/github/build.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Karate tests
if: ${{ github.event.inputs.karate == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
cd config/docker
./docker-compose.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../src/test/api/karate
./launchAll.sh
cd ../../../../config/docker
docker-compose down --remove-orphans
run: ./CICD/github/launch_karate_tests.sh

- name: Cypress tests
if: ${{ github.event.inputs.cypress == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
cd config/docker
./docker-compose-cypress.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../
./gradlew runCypressTests
cd config/docker
docker-compose down
run: ./CICD/github/launch_cypress_tests.sh

- name : Publish Documentation
if : ${{ github.event.inputs.doc == 'true' || github.event_name == 'schedule'}}
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/testWithOldMongoKeycloak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

name: Test with old mongo & keycloak versions

on:
schedule:
# launch a build every day on develop
- cron: '0 23 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Job status
run: |
export OF_VERSION=$(<VERSION)
echo "----------------------------"
echo "Trigger by : ${{ github.event_name }}"
echo "On branch : ${{ github.ref_name }} "
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties','**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Install
run: ./CICD/github/install.sh

- name: Build
run: |
./CICD/github/build.sh
./CICD/github/setOldMongoKeycloakVersions.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Karate tests
run: ./CICD/github/launch_karate_tests.sh

- name: Cypress tests
run: ./CICD/github/launch_cypress_tests.sh


30 changes: 30 additions & 0 deletions CICD/github/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Copyright (c) 2022, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of the OperatorFabric project.


# Script launch form the root of the git projet by github actions

export OF_VERSION=$(<VERSION)
docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
echo "npm version $(npm -version)"
echo "node version $(node --version)"
sdk version
javac -version
./gradlew --version
./gradlew --build-cache copyDependencies test jacocoTestReport sonarqube dockerTag${OF_VERSION}
status_code=$?
docker-compose -f src/main/docker/test-environment/docker-compose.yml down
# propage the status code for github actions
exit $status_code
20 changes: 20 additions & 0 deletions CICD/github/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# Copyright (c) 2022, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of the OperatorFabric project.


# Script launch form the root of the git projet by github actions

curl -s "https://get.sdkman.io" | bash ;
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config ;
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config ;
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
sudo apt-get install jq
git config --global user.email "opfabtech@gmail.com"
git config --global user.name "OpfabTech"
38 changes: 38 additions & 0 deletions CICD/github/launch_cypress_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Copyright (c) 2022, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of the OperatorFabric project.


# Script launch form the root of the git projet by github actions

testFiles=$1
if [ -z $testFiles ]
then
testFiles="*"
fi


source $HOME/.sdkman/bin/sdkman-init.sh;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
cd config/docker
./docker-compose-cypress.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../
# Set a more important timeout for CI/CD as it is usually slower than local computer
export CYPRESS_defaultCommandTimeout=10000
./gradlew runSomeCypressTests -PspecFiles=$testFiles
status_code=$?
cd config/docker
docker-compose down
# propage the status code for github actions
exit $status_code
Loading

0 comments on commit 7870ce1

Please sign in to comment.