Integration Tests #293
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: Integration Tests | |
on: | |
schedule: | |
- cron: '00 08 * * *' | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
type: choice | |
description: Select the Environment | |
options: | |
- dev | |
- uat | |
default: dev | |
tags: | |
description: 'run the tests tagged with' | |
required: false | |
type: string | |
default: 'runnable' | |
junit: | |
description: 'enable junit' | |
required: false | |
type: choice | |
options: | |
- true | |
- false | |
default: false | |
permissions: | |
id-token: write | |
contents: read | |
deployments: write | |
jobs: | |
integration_test: | |
name: Test ${{(github.event.inputs == null && 'dev') || inputs.environment }} | |
runs-on: ubuntu-latest | |
environment: ${{(github.event.inputs == null && 'dev') || inputs.environment }} | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | |
- name: Create reports folder | |
shell: bash | |
run: | | |
mkdir -p ./integration-test/reports | |
mkdir -p ./integration-test/junit | |
- name: Login | |
id: login_download | |
# from https://github.com/Azure/login/commits/master | |
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 | |
with: | |
client-id: ${{ secrets.CI_CLIENT_ID }} | |
tenant-id: ${{ secrets.TENANT_ID }} | |
subscription-id: ${{ secrets.SUBSCRIPTION_ID }} | |
# - name: Download old reports | |
# uses: azure/CLI@v1 | |
# env: | |
# STORAGE_NAME: ${{ vars.INTEGRATION_TEST_STORAGE_ACCOUNT_NAME }} | |
# STORAGE_FOLDER: ${{ vars.INTEGRATION_TEST_REPORTS_FOLDER }} | |
# with: | |
# inlineScript: | | |
# az storage blob download-batch \ | |
# --destination "./integration-test/reports" \ | |
# --source "${{ env.STORAGE_FOLDER }}" \ | |
# --account-name "${{ env.STORAGE_NAME }}" \ | |
# --subscription "${{ secrets.SUBSCRIPTION_ID }}" \ | |
# --pattern "reports/*" \ | |
# --auth-mode login | |
- name: Run Integration Tests | |
shell: bash | |
run: | | |
cd ./integration-test | |
docker build -t fdr1_test . | |
docker run \ | |
-e INTEGRATION_TEST_SUBSCRIPTION_KEY="${{ secrets.INTEGRATION_TEST_SUBSCRIPTION_KEY }}" \ | |
-e TAGS="${{ inputs.tags }}" \ | |
-e ENV="${{( github.event.inputs == null && 'dev') || inputs.environment }}" \ | |
-e CONFIG_FILE="/config/${{( github.event.inputs == null && 'dev') || inputs.environment }}.json" \ | |
-v ./reports:/app/reports fdr1_test | |
- name: Login | |
id: login_upload | |
# from https://github.com/Azure/login/commits/master | |
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 | |
with: | |
client-id: ${{ secrets.CI_CLIENT_ID }} | |
tenant-id: ${{ secrets.TENANT_ID }} | |
subscription-id: ${{ secrets.SUBSCRIPTION_ID }} | |
- name: Upload reports | |
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1 | |
env: | |
STORAGE_NAME: ${{ vars.INTEGRATION_TEST_STORAGE_ACCOUNT_NAME }} | |
STORAGE_FOLDER: ${{ vars.INTEGRATION_TEST_REPORTS_FOLDER }} | |
with: | |
inlineScript: | | |
az storage blob upload-batch \ | |
--destination '${{ env.STORAGE_FOLDER }}/reports' \ | |
--source ./integration-test/reports \ | |
--account-name ${{ env.STORAGE_NAME }} \ | |
--subscription ${{ secrets.SUBSCRIPTION_ID }} \ | |
--overwrite true \ | |
--auth-mode login | |
- name: Upload junit | |
if: ${{ inputs.junit == true }} | |
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1 | |
env: | |
STORAGE_NAME: ${{ vars.INTEGRATION_TEST_STORAGE_ACCOUNT_NAME }} | |
STORAGE_FOLDER: ${{ vars.INTEGRATION_TEST_REPORTS_FOLDER }} | |
with: | |
inlineScript: | | |
az storage blob upload-batch \ | |
--destination '${{ env.STORAGE_FOLDER }}/junit' \ | |
--source ./integration-test/junit \ | |
--account-name ${{ env.STORAGE_NAME }} \ | |
--subscription ${{ secrets.SUBSCRIPTION_ID }} \ | |
--overwrite true \ | |
--auth-mode login | |
notify: | |
needs: [ integration_test ] | |
runs-on: ubuntu-latest | |
name: Notify | |
if: always() | |
steps: | |
- name: Report Status | |
if: always() | |
uses: ravsamhq/notify-slack-action@be814b201e233b2dc673608aa46e5447c8ab13f2 # v2 | |
with: | |
status: ${{ needs.integration_test.result }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
notify_when: 'failure,skipped' | |
notification_title: '<{run_url}|Scheduled Integration Test> has {status_message}' | |
message_format: '{emoji} <{run_url}|{workflow}> {status_message} in <{repo_url}|{repo}>' | |
footer: 'Linked to <{workflow_url}| workflow file>' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEST_SLACK_WEBHOOK_URL }} | |