INJIWEB-940 - Updated sunbird test case to run multiple times if it g… #31
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: Maven Package upon a push | |
on: | |
release: | |
types: [published] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
inputs: | |
message: | |
description: 'Message for manually triggering' | |
required: false | |
default: 'Triggered for Updates' | |
type: string | |
push: | |
branches: | |
- '!release-branch' | |
- release* | |
- master | |
- 1.* | |
- develop* | |
- MOSIP* | |
- qa-develop | |
- injiweb-* | |
jobs: | |
build-mimoto: | |
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./ | |
BUILD_ARTIFACT: mimoto | |
secrets: | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
## Recreate zips to provide support for docker unzip operation | |
recreate-zips: | |
needs: build-mimoto | |
runs-on: ubuntu-latest | |
env: | |
BUILD_ARTIFACT: mimoto | |
NEW_BUILD_ARTIFACT: mimoto-recreated | |
SERVICE_LOCATION: mimoto | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
if: ${{ ( env.BUILD_ARTIFACT != 'false' ) }} | |
with: | |
name: ${{ env.BUILD_ARTIFACT }} | |
path: ../ | |
- name: recreate zip | |
run: | | |
cd ../ | |
echo "LS ./" | |
ls . | |
echo "unzip command" | |
unzip -uj "${{ env.BUILD_ARTIFACT }}.zip" "target/*" -d "${{ env.SERVICE_LOCATION }}/target/" | |
echo "find command" | |
cd ${{ env.SERVICE_LOCATION }} | |
find ../${{ env.SERVICE_LOCATION }} -path '*/target/*' -name '*.jar' -type f -executable -exec zip ${{ env.NEW_BUILD_ARTIFACT }}.zip {} + | |
- name: Upload the springboot jars | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.NEW_BUILD_ARTIFACT }} | |
path: ${{ env.NEW_BUILD_ARTIFACT }}.zip | |
publish_to_nexus: | |
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}" | |
needs: build-mimoto | |
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./ | |
secrets: | |
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
sonar_analysis: | |
needs: build-mimoto | |
if: "${{ github.event_name != 'pull_request' }}" | |
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 | |
with: | |
SERVICE_LOCATION: ./ | |
secrets: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ORG_KEY: ${{ secrets.ORG_KEY }} | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
build-dockers: | |
needs: recreate-zips | |
strategy: | |
matrix: | |
include: | |
- SERVICE_LOCATION: '../mimoto' | |
SERVICE_NAME: 'mimoto' | |
BUILD_ARTIFACT: 'mimoto-recreated' | |
fail-fast: false | |
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21 | |
name: ${{ matrix.SERVICE_NAME }} | |
with: | |
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} | |
SERVICE_NAME: ${{ matrix.SERVICE_NAME }} | |
BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }} | |
secrets: | |
DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} | |
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} | |
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
build-maven-apitest-mimoto: | |
uses: mosip/kattu/.github/workflows/maven-build.yml@master | |
with: | |
SERVICE_LOCATION: ./api-test | |
BUILD_ARTIFACT: apitest-mimoto | |
secrets: | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
publish_to_nexus_apitest_mimoto: | |
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}" | |
needs: build-maven-apitest-mimoto | |
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master | |
with: | |
SERVICE_LOCATION: ./api-test | |
secrets: | |
OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
build-apitest-mimoto-local: | |
needs: build-maven-apitest-mimoto | |
runs-on: ubuntu-latest | |
env: | |
NAMESPACE: ${{ secrets.dev_namespace_docker_hub }} | |
SERVICE_NAME: apitest-mimoto | |
SERVICE_LOCATION: api-test | |
BUILD_ARTIFACT: apitest-mimoto-local | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
ref: ${{ github.ref }} | |
java-version: 11 | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Setup the settings file for ossrh server | |
run: echo "<settings> <servers> <server> <id>ossrh</id> <username>${{secrets.ossrh_user}}</username> <password>${{secrets.ossrh_secret}}</password> </server> </servers> <profiles> <profile> <id>ossrh</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>${{secrets.gpg_secret}}</gpg.passphrase> </properties> </profile> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository> <id>snapshots-repo</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>releases-repo</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </profile> <profile> <id>sonar</id> <properties> <sonar.sources>.</sonar.sources> <sonar.host.url>https://sonarcloud.io</sonar.host.url> </properties> <activation> <activeByDefault>false</activeByDefault> </activation> </profile> </profiles> </settings>" > $GITHUB_WORKSPACE/settings.xml | |
- name: Build Automationtests with Maven | |
run: | | |
cd ${{ env.SERVICE_LOCATION}} | |
mvn clean package -s $GITHUB_WORKSPACE/settings.xml | |
- name: Copy configuration files to target directory. | |
run: | | |
cp -r ${{ env.SERVICE_LOCATION}}/target/classes/config ${{ env.SERVICE_LOCATION}}/target/config | |
cp -r ${{ env.SERVICE_LOCATION}}/testNgXmlFiles ${{ env.SERVICE_LOCATION}}/target/testNgXmlFiles | |
- name: Ready the springboot artifacts | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
run: | | |
## FIND JARS & COPY ONLY EXECUTABLE JARs STORED UNDER TARGET DIRECTORY | |
find ${{ env.SERVICE_LOCATION }} -path '*/target/*' -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + | |
- name: Upload the springboot jars | |
if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BUILD_ARTIFACT }} | |
path: ${{ env.BUILD_ARTIFACT }}.zip | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,author,commit,workflow,job # selectable (default: repo,message) | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | |
if: failure() # Pick up events even if the job fails or is canceled. | |
build-dockers_apitest_mimoto: | |
needs: build-apitest-mimoto-local | |
strategy: | |
matrix: | |
include: | |
- SERVICE_LOCATION: 'api-test' | |
SERVICE_NAME: 'apitest-mimoto' | |
BUILD_ARTIFACT: 'apitest-mimoto-local' | |
ONLY_DOCKER: true | |
fail-fast: false | |
name: ${{ matrix.SERVICE_NAME }} | |
uses: mosip/kattu/.github/workflows/docker-build.yml@master | |
with: | |
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} | |
SERVICE_NAME: ${{ matrix.SERVICE_NAME }} | |
BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }} | |
ONLY_DOCKER: ${{ matrix.ONLY_DOCKER }} | |
secrets: | |
DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} | |
ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} | |
RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} | |
# Commenting out sonar check for api test as it will not work on JDK-11 | |
# sonar_analysis_apitest_mimoto: | |
# needs: build-maven-apitest-mimoto | |
# if: "${{ github.event_name != 'pull_request' }}" | |
# uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master | |
# with: | |
# SERVICE_LOCATION: ./api-test | |
# secrets: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# ORG_KEY: ${{ secrets.ORG_KEY }} | |
# OSSRH_USER: ${{ secrets.OSSRH_USER }} | |
# OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} | |
# OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
# GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_INJI_TEAM }} |