Skip to content

BCDA-8637: Smoke tests github workflow #39

BCDA-8637: Smoke tests github workflow

BCDA-8637: Smoke tests github workflow #39

Workflow file for this run

name: 'BCDA Smoke Tests'
on:
pull_request:
paths:
- .github/workflows/smoke-tests.yml
workflow_dispatch:
inputs:
app-branch:
description: The branch of the bcda-app to use for the test execution.
required: true
type: 'string'
default: 'main'
ops-branch:
description: The branch of the bcda-ops to use for the test execution.
required: true
type: 'string'
default: 'main'
ssas-app-branch:
description: The branch of the ssas-app to use for the test execution.
required: true
type: 'string'
default: 'main'
ssas-ops-branch:
description: The branch of the ssas-ops to use for the test execution.
required: true
type: 'string'
default: 'main'
env:
description: The environment in which to run smoke tests
required: true
type: choice
options:
- 'dev'
- 'test'
- 'opensbx'
- 'prod'
test-aco:
description: Run the tests using the selected ACO
required: true
type: choice
options:
- 'small'
- 'medium'
- 'large'
- 'extra-large'
- 'dev'
- 'paca'
default: 'dev'
smoke-tests:
description: Flag which indicates if smoke integration tests should be run
required: true
type: boolean
default: true
postman-tests:
description: Flag which indicates if smoke integration tests should be run
required: true
type: boolean
default: true
eoy:
description: The type of maintenance mode to put the application into. Empty string means no maintenance (i.e. normal)
required: true
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ inputs.env }}
cancel-in-progress: false
permissions:
id-token: write
contents: read
env:
COMPOSE_INTERACTIVE_NO_CLI: 1
VAULT_PW: ${{ secrets.VAULT_PW }}
jobs:
# api_smoke_tests:
# needs: get_params
# name: run api smoke tests
# runs-on: self-hosted
# env:
# DOCKER_BUILDKIT: 1
# COMPOSE_DOCKER_CLI_BUILD: 1
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install Ansible
# run: |
# #sudo yum update -y
# sudo yum install python3-pip -y
# python3 -m pip install ansible==6.5.0
# - name: Decrypt secrets
# run: |
# echo $VAULT_PW > .vault_password
# bash ops/secrets --decrypt
# mv -fv shared_files/encrypted/* shared_files/decrypted/
# - uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
# env:
# AWS_REGION: ${{ vars.AWS_REGION }}
# with:
# params: |
# CLIENT_CREDENTIALS_PARAMS=/bcda/workflows/dev_client_credentials
# DENYLIST_CLIENT_CREDENTIALS_PARAMS=/bcda/workflows/deny_client_credentials
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Build the stack
# run: |
# make docker-bootstrap
# - name: Run all tests
# run: |
# CLIENT_ID=$(echo $CLIENT_CREDENTIALS_PARAMS | jq .client_id)
# CLIENT_SECRET=$(echo $CLIENT_CREDENTIALS_PARAMS | jq .client_secret)
# DENY_CLIENT_ID=$(echo $DENYLIST_CLIENT_CREDENTIALS_PARAMS | jq .client_id)
# DENY_CLIENT_SECRET=$(echo $DENYLIST_CLIENT_CREDENTIALS_PARAMS | jq .client_secret)
# make postman env=dev CLIENT_ID="${CLIENT_ID}" CLIENT_SECRET="$CLIENT_SECRET" BLACKLIST_CLIENT_ID=$DENY_CLIENT_ID BLACKLIST_CLIENT_SECRET=$DENY_CLIENT_SECRET maintenanceMode=""
# # make smoke-test env=dev maintenanceMode=""
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report
# path: ./test_results/latest/testcoverage.out
ssas_smoke_tests:
name: run ssas smoke tests
runs-on: self-hosted
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
steps:
# - name: Decrypt secrets
# run: |
# echo $VAULT_PW > .vault_password
# bash ops/secrets --decrypt
# mv -fv shared_files/encrypted/* shared_files/decrypted/
- uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
env:
AWS_REGION: ${{ vars.AWS_REGION }}
with:
params: |
SSAS_CREDENTIALS=/bcda/workflows/dev/ssas_admin_credentials
ASSERTION_AUD=/bcda/workflows/dev/ssas_assertion_aud
HOST=/bcda/workflows/dev/ssas_elb
CERT=/bcda/dev/api/BCDA_CA_FILE.pem
- name: checkout bcda-ssas
uses: actions/checkout@v4
with:
repository: CMSgov/bcda-ssas-app
ref: 'main'
- name: Install docker compose manually
run: |
sudo mkdir -p /usr/local/lib/docker/cli-plugins
sudo curl -SL https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
sudo chown root:root /usr/local/lib/docker/cli-plugins/docker-compose
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
- name: Build the stack
run: |
make docker-bootstrap
- name: add cert
run: |
yum install ca-certificates
- name: copy cert
run: |
echo $CERT > ~/cert.pem
sudo cp ~/cert.pem /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract
ls /etc/pki/ca-trust/source/anchors/
- name: Run all tests
run: |
CLIENT_ID=$(echo $SSAS_CREDENTIALS | jq .client_id)
CLIENT_SECRET=$(echo $SSAS_CREDENTIALS | jq .client_secret)
docker compose -f docker-compose.test.yml run --rm postman_test test/postman_test/SSAS_Smoke_Test.postman_collection.json -e test/postman_test/aws.postman_environment.json --global-var adminClientId=$CLIENT_ID --global-var adminClientSecret=$CLIENT_SECRET --global-var ssas_client_assertion_aud=$ASSERTION_AUD --global-var host=$HOST
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ./test_results/latest/testcoverage.out
# checkout app
# checkout ssas
# decrypt secrets
# build app image
# build ssas image
# run ssas postman tests
# refresh cclf files
# run api postman tests
# run smoke tests
# run paca smoke tests