Skip to content

Task advanced : add the possibility to create non-repetitive card (#7… #25888

Task advanced : add the possibility to create non-repetitive card (#7…

Task advanced : add the possibility to create non-repetitive card (#7… #25888

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
# launch a build every day on develop
- cron: '0 22 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
build:
description: 'Build'
required: false
default: 'true'
karate:
description: 'Karate tests'
required: false
default: 'true'
cypress:
description: 'Cypress Tests'
required: false
default: 'true'
cypressTestFiles:
description: 'Cypress Test files'
required: false
default: '*'
gatling:
description: 'Load tests'
required: false
default: 'false'
doc:
description: 'Build and publish documentation '
required: false
default: 'false'
docLatest:
description: 'Build and publish documentation - Latest'
required: false
default: 'false'
dockerPush:
description: 'Docker push'
required: false
default: 'false'
dockerPushLatest:
description: 'Docker push - Latest'
required: false
default: 'false'
permissions: read-all
jobs:
build:
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' }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Job status
env:
EVENT_NAME: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
echo "----------------------------"
echo "Trigger by : $EVENT_NAME"
echo "On branch : $REF_NAME "
echo "PR source branch : $HEAD_REF "
echo "PR target branch : $BASE_REF "
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties','**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
# Install all required tools
- name: Install
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'}}
# build.sh set variable for sdk, nvm and gradle
# if variable is set in install step it is not accessible in this step
run: ./CICD/github/build.sh
env:
# 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: ./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: ./CICD/github/launch_cypress_tests.sh ${{ github.event.inputs.cypressTestFiles }}
- name: Upload cypress screenshots and logs
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: cypress-screenshots
path: |
src/test/cypress/cypress/screenshots
opfab.log
- name: Load tests
if: ${{ github.event.inputs.gatling == 'true' || github.event_name == 'schedule' }}
run: ./CICD/github/launch_load_tests.sh
publish:
runs-on: ubuntu-latest
environment: publishVersion
permissions:
contents: write
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' }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Job status
env:
EVENT_NAME: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
echo "----------------------------"
echo "Trigger by : $EVENT_NAME"
echo "On branch : $REF_NAME "
echo "PR source branch : $HEAD_REF "
echo "PR target branch : $BASE_REF "
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties','**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
# Install all required tools
- name: Install
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: ./CICD/github/build.sh
env:
# 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: ./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: ./CICD/github/launch_cypress_tests.sh
- name: Upload cypress screenshots
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: cypress-screenshots
path: src/test/cypress/cypress/screenshots
- name: Load tests
if: ${{ github.event.inputs.gatling == 'true' || github.event_name == 'schedule' }}
run: ./CICD/github/launch_load_tests.sh
- name : Publish Documentation
if : ${{ github.event.inputs.doc == 'true' || github.event_name == 'schedule'}}
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;
./gradlew --build-cache generateSwaggerUI asciidoctor;
./CICD/github/upload_doc.sh
env:
GH_DOC_TOKEN: ${{ secrets.GH_DOC_TOKEN}}
- name : Publish Documentation (latest)
if : ${{ github.event.inputs.docLatest == 'true' }}
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;
./gradlew --build-cache generateSwaggerUI asciidoctor;
./CICD/github/upload_doc.sh --updateLatest true
env:
GH_DOC_TOKEN: ${{ secrets.GH_DOC_TOKEN}}
- name : Push images to dockerhub
if: ${{ github.event.inputs.dockerPush == 'true' || github.event_name == 'schedule' }}
run: |
echo ${{ secrets.DOCKER_TOKEN }} | docker login --username opfabtravis --password-stdin
docker images --format "{{.Repository}}:{{.Tag}}" | grep lfe | while read image; do
echo push ${image}
docker push ${image}
done
- name : Push images latest to dockerhub
if: ${{ github.event.inputs.dockerPushLatest == 'true' }}
run: |
echo ${{ secrets.DOCKER_TOKEN }} | docker login --username opfabtravis --password-stdin
docker images --format "{{.Repository}}:{{.Tag}}" | grep lfe | while read image; do
export repository=$(echo ${image} | cut -d ":" -f 1)
echo "create tag latest for ${repository}"
docker tag ${image} ${repository}:latest
docker push ${repository}:latest
done