0% found this document useful (0 votes)
87 views10 pages

Main (CF Consolidated)

This GitHub Actions workflow defines a series of jobs to build, deploy, and test a backend and frontend application on Cloud Foundry. The jobs include unit testing, integration testing, building backend and frontend artifacts, deploying the artifacts to multiple Cloud Foundry organizations, configuring roles, and performing smoke tests on the deployed applications. The workflow runs on scheduled cron triggers and manual workflow dispatches.

Uploaded by

Devops Anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views10 pages

Main (CF Consolidated)

This GitHub Actions workflow defines a series of jobs to build, deploy, and test a backend and frontend application on Cloud Foundry. The jobs include unit testing, integration testing, building backend and frontend artifacts, deploying the artifacts to multiple Cloud Foundry organizations, configuring roles, and performing smoke tests on the deployed applications. The workflow runs on scheduled cron triggers and manual workflow dispatches.

Uploaded by

Devops Anil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 10

name: CF Consolidated Pipeline

on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:

env:
CF_USERNAME: ${{ secrets.CF_USERNAME }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
CF_SUBSCRIBER1_TENANT_ID: 2ab1bde0-9eb2-47e6-b7b6-f02065ea847f
CF_SUBSCRIBER1_ORG_NAME: fca-subscriber1
CF_SUBSCRIBER2_TENANT_ID: b86869e2-c393-45c9-ba2c-54a32bbf97b6
CF_SUBSCRIBER2_ORG_NAME: fca-subscriber2

jobs:
unit-test-backend:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run FCA backend unit tests
run: |
. ./cicd/scripts/script-setup.sh
./cicd/scripts/execute-junit-tests.sh

unit-test-frontend:
runs-on: ubuntu-20.04
container: fioneerfca/unit-test-runner:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
steps:
- uses: actions/checkout@v2
- name: Run FCA UI unit tests
run: |
. ./cicd/scripts/script-setup.sh
./cicd/scripts/execute-ui-unit-tests.sh

integration-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run FCA integration tests
run: |
. ./cicd/scripts/script-setup.sh
./cicd/scripts/execute-integration-tests.sh

mock-verification-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run FCA mock verification tests
run: |
. ./cicd/scripts/script-setup.sh
./cicd/scripts/execute-mock-verification-tests.sh

generate-matrix:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Generate OData Test Matrix
id: setup-odata-matrix
run: |
pip install "robotframework>=3.2"
cd $GITHUB_WORKSPACE/cicd/scripts/robot
MATRIX=$(python3 generate_robot_test_matrices.py
$GITHUB_WORKSPACE/robot/src/test/robot/tests/odata --test-count 2 --matrix-part
branch,main)
echo "$MATRIX"
echo ::set-output name=odata-matrix::{\"include\":$MATRIX}
- name: Generate UI Test Matrix
id: setup-ui-matrix
run: |
pip install "robotframework>=3.2"
cd $GITHUB_WORKSPACE/cicd/scripts/robot
MATRIX=$(python3 generate_robot_test_matrices.py
$GITHUB_WORKSPACE/robot/src/test/robot/tests/ui --test-count 2 --matrix-part
branch,main)
echo "$MATRIX"
echo ::set-output name=ui-matrix::{\"include\":$MATRIX}
outputs:
odata-matrix: ${{ steps.setup-odata-matrix.outputs.odata-matrix }}
ui-matrix: ${{ steps.setup-ui-matrix.outputs.ui-matrix }}

build-backend:
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
steps:
- name: checkout branch
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: use cached maven repo
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: |
cd backend
mvn clean install
- name: stash workspace
uses: actions/upload-artifact@v2
with:
name: backendmta-target-${{ matrix.branch }}
path: backend/backendmta/target/*

deploy-backend:
needs: [ build-backend ]
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
steps:
- name: checkout branch
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: unstash workspace
uses: actions/download-artifact@v2
with:
name: backendmta-target-${{ matrix.branch }}
path: backend-mtar
- name: deploy backend
run: |
. ./cicd/scripts/script-setup.sh

wget -q
https://github.com/cloudfoundry-incubator/multiapps-cli-plugin/releases/download/
v2.1.0/mta_plugin_linux_amd64 && \
chmod +x mta_plugin_linux_amd64 && \
cf install-plugin mta_plugin_linux_amd64 -f

"$SCRIPT_DIR"/cf/cf-clean-install-backend.sh ${{ matrix.branch }} "$


{GITHUB_WORKSPACE}"/backend-mtar
"$SCRIPT_DIR"/cf/cf-toggle-test-profile.sh ${{ matrix.branch }} on
build-frontend:
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
steps:
- name: checkout branch
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: use cached maven repo
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: |
cd frontend.ui5
mvn clean install
- name: stash workspace
uses: actions/upload-artifact@v2
with:
name: frontendmta-target-${{ matrix.branch }}
path: |
frontend.ui5/target/*.mtar
frontend.ui5/target/*.mtaext

deploy-frontend:
needs: [ build-frontend, deploy-backend ]
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
steps:
- name: checkout branch
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: unstash workspace
uses: actions/download-artifact@v2
with:
name: frontendmta-target-${{ matrix.branch }}
path: frontend-mtar
- name: deploy frontend
run: |
. ./cicd/scripts/script-setup.sh
wget -q
https://github.com/cloudfoundry-incubator/multiapps-cli-plugin/releases/download/
v2.1.0/mta_plugin_linux_amd64 && \
chmod +x mta_plugin_linux_amd64 && \
cf install-plugin mta_plugin_linux_amd64 -f

"$SCRIPT_DIR"/cf/cf-install-frontend.sh ${{ matrix.branch }} "$


{GITHUB_WORKSPACE}"/frontend-mtar

map-uaa-roles:
needs: [ deploy-backend ]
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container:
image: fioneer.jfrog.io/fioneer-virtual/cicd/sap-btp-deployer:v1.0.0
credentials:
username: ${{ secrets.ARTIFACTORY_READ_USERNAME }}
password: ${{ secrets.ARTIFACTORY_READ_PASSWORD }}
steps:
- name: checkout branch
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: Map UAA Roles
run: |
. ./cicd/scripts/script-setup.sh
"$SCRIPT_DIR"/cf/cf-map-uaa-roles.sh ${{ matrix.branch }}

cf-add-subscriber1:
needs: deploy-frontend
runs-on: ubuntu-20.04
container:
image: fioneer.jfrog.io/fioneer-virtual/cicd/sap-btp-deployer:v1.0.0
credentials:
username: ${{ secrets.ARTIFACTORY_READ_USERNAME }}
password: ${{ secrets.ARTIFACTORY_READ_PASSWORD }}
steps:
- name: checkout branch
uses: actions/checkout@v2
- name: script
run: |
. ./cicd/scripts/script-setup.sh
"$SCRIPT_DIR"/cf/cf-subscribe.sh ${{ matrix.branch }}
"$CF_SUBSCRIBER1_TENANT_ID" "$CF_SUBSCRIBER1_ORG_NAME"
- name: stash saas details to reuse for cleanup
uses: actions/upload-artifact@v2
with:
name: saas-details
path: cf_saas_*.txt

cf-smoketest-backend:
needs: map-uaa-roles
runs-on: ubuntu-20.04
container:
image: fioneer.jfrog.io/fioneer-virtual/cicd/sap-btp-deployer:v1.0.0
credentials:
username: ${{ secrets.ARTIFACTORY_READ_USERNAME }}
password: ${{ secrets.ARTIFACTORY_READ_PASSWORD }}
steps:
- name: checkout branch
uses: actions/checkout@v2
- name: script
run: |
. ./cicd/scripts/script-setup.sh

"$SCRIPT_DIR"/cf/test-smoke-backend.sh ${{ matrix.branch }}


- uses: actions/upload-artifact@v2
with:
name: odata-response
path: odata_response*.xml

cf-smoketest-frontend-curl:
needs: [ deploy-frontend, map-uaa-roles ]
runs-on: ubuntu-20.04
steps:
- name: checkout branch
uses: actions/checkout@v2
- name: hit frontend
run: |
. ./cicd/scripts/script-setup.sh
. "$SCRIPT_DIR"/cf/test-smoke-frontend.sh ${{ matrix.branch }}
- name: archive curl logs
uses: actions/upload-artifact@v2
with:
name: approuter-response
path: curl_frontend*.log

build-selenium-tester:
runs-on: ubuntu-20.04
steps:
- name: checkout branch
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: use cached maven repo
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: |
# check maven version
mvn -version

# build
cd jenkins/selenium
mvn clean install
- name: stash tester jar
uses: actions/upload-artifact@v2
with:
name: selenium-tester
path: jenkins/selenium/target/selenium-0.0.2-SNAPSHOT-jar-with-
dependencies.jar

cf-smoketest-frontend-selenium:
needs: [ build-selenium-tester, cf-add-subscriber1 ]
runs-on: ubuntu-20.04
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
services:
hub:
image: selenium/standalone-chrome:92.0.4515.159-chromedriver-92.0.4515.107-
20210823
steps:
- name: checkout branch
uses: actions/checkout@v2
- name: unstash tester jar
uses: actions/download-artifact@v2
with:
name: selenium-tester
# can't use curr dir (/). Default user "seluser" doesn't have permission
to write/unstash files there
path: /tmp
- name: run tester
run: |
. ./cicd/scripts/script-setup.sh
"$SCRIPT_DIR"/cf/test-smoke-frontend-selenium.sh ${{ matrix.branch }} /tmp
sub1
- name: archive screenshots
uses: actions/upload-artifact@v2
with:
name: frontend-screenshots
path: /tmp/*.png

run-robot-odata-tests:
runs-on: ubuntu-20.04
needs: [generate-matrix, map-uaa-roles, deploy-frontend]
services:
hub:
image: selenium/standalone-chrome:92.0.4515.159-chromedriver-92.0.4515.107-
20210823
env:
SE_NODE_MAX_SESSIONS: 2
SE_NODE_OVERRIDE_MAX_SESSIONS: true
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.odata-matrix) }}
fail-fast: false
env:
DEFAULT_SELENIUM_TIMEOUT: 20
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- uses: actions/checkout@v2
with:
repository: fioneer/robotframework-sapcommon
ref: master
path: robotframework-sapcommon
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Run Robot OData Tests
run: |
pip install -r ${GITHUB_WORKSPACE}/robot/src/test/robot/requirements.txt
. ./cicd/scripts/script-setup.sh

"$SCRIPT_DIR"/cf-robot-tests.sh ${{ matrix.branch}} \


${GITHUB_WORKSPACE}/robot \
${GITHUB_WORKSPACE}/robotframework-sapcommon \
odata \
True \
odata \
odata \
"${{ matrix.robot_args }}"
- uses: actions/upload-artifact@v2
if: always()
with:
name: odata-test-artifacts${{ matrix.robot_args }}
path: |
robot/target/robot/odata/*screenshot*
robot/target/robot/odata/report.html
robot/target/robot/odata/log.html
robot/target/robot/odata/output.xml

run-robot-ui-tests:
runs-on: ubuntu-20.04
needs: [ generate-matrix, map-uaa-roles, deploy-frontend ]
services:
hub:
image: selenium/standalone-chrome:92.0.4515.159-chromedriver-92.0.4515.107-
20210823
env:
SE_NODE_MAX_SESSIONS: 2
SE_NODE_OVERRIDE_MAX_SESSIONS: true
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.ui-matrix) }}
fail-fast: false
env:
DEFAULT_SELENIUM_TIMEOUT: 20
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- uses: actions/checkout@v2
with:
repository: fioneer/robotframework-sapcommon
ref: master
path: robotframework-sapcommon
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Run Robot UI Tests
run: |
pip install -r ${GITHUB_WORKSPACE}/robot/src/test/robot/requirements.txt
. ./cicd/scripts/script-setup.sh

"$SCRIPT_DIR"/cf-robot-tests.sh ${{ matrix.branch}} \


${GITHUB_WORKSPACE}/robot \
${GITHUB_WORKSPACE}/robotframework-sapcommon \
ui-chrome \
True \
ui \
ui-chrome \
"${{ matrix.robot_args }}"
- uses: actions/upload-artifact@v2
if: always()
with:
name: ui-test-artifacts${{ matrix.robot_args }}
path: |
robot/target/robot/ui-chrome/*screenshot*
robot/target/robot/ui-chrome/report.html
robot/target/robot/ui-chrome/log.html
robot/target/robot/ui-chrome/output.xml

cleanup:
needs: [ run-robot-ui-tests, run-robot-odata-tests ]
if: always()
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container: fioneerfca/main-agent:c3d83d6c5a590c0f9d0744c4d36710f3a6b643gh
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- name: deploy backend
run: |
. ./cicd/scripts/script-setup.sh
"$SCRIPT_DIR"/cf/cf-toggle-test-profile.sh ${{ matrix.branch }} off

merge-logs:
needs: [ run-robot-ui-tests, run-robot-odata-tests ]
if: always()
runs-on: ubuntu-20.04
strategy:
matrix:
branch:
- ${{ github.event.inputs.branch || 'main' }}
container: fioneerfca/main-agent:1df14cffc5a8da569c5e1483bdd6f594561d46a0
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
- uses: actions/download-artifact@v2
- name: merge odata and ui logs
run: |
echo "${{ matrix.robot_args }}"
pip install -r ${GITHUB_WORKSPACE}/robot/src/test/robot/requirements.txt
. ./cicd/scripts/script-setup.sh
"$SCRIPT_DIR"/merge-robot-logs.sh
- uses: actions/upload-artifact@v2
if: always()
with:
name: odata-merged-test-artifacts
path: |
merged-odata-test-results/
- uses: actions/upload-artifact@v2
if: always()
with:
name: ui-merged-test-artifacts
path: |
merged-ui-test-results/

delete-odata-artifacts:
runs-on: ubuntu-20.04
needs: [ merge-logs, generate-matrix ]
if: always()
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.odata-matrix) }}
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: odata-test-artifacts${{ matrix.robot_args }}

delete-ui-artifacts:
runs-on: ubuntu-20.04
needs: [ merge-logs, generate-matrix ]
if: always()
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.ui-matrix) }}
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: ui-test-artifacts${{ matrix.robot_args }}

You might also like