Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added int test pipeline #48

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/06_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Integration Tests

on:
schedule:
- cron: '00 08 * * *'

workflow_dispatch:
inputs:
environment:
required: true
type: choice
description: Select the Environment
options:
- dev
- uat
tags:
description: 'run the tests tagged with'
required: false
type: string
default: 'runnable'
# canary:
# description: 'run the tests on canary version'
# required: false
# type: boolean
# default: false
notify:
required: false
type: boolean
description: 'send the slack notification'
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: Login
id: login
# from https://github.com/Azure/login/commits/master
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}

- name: Download old reports
uses: azure/CLI@v1
env:
STORAGE_NAME: pagopadweusharedtxnmsa
STORAGE_FOLDER: testfrancesco
with:
inlineScript: |
az storage blob download-batch -d reports -s '${{ env.STORAGE_FOLDER }}' --account-name ${{ env.STORAGE_NAME }} --auth-mode key

# - name: Run Integration Tests
# shell: bash
# run: |
# export PSP_SUBSCRIPTION_KEY=${{ secrets.PSP_SUBSCRIPTION_KEY }}
# export ORG_SUBSCRIPTION_KEY=${{ secrets.ORG_SUBSCRIPTION_KEY }}
# export TAGS=${{ inputs.tags }}
#
# cd ./integration-test
# chmod +x ./run_test.sh
# ./run_test.sh ${{( github.event.inputs == null && 'dev') || inputs.environment }}

- name: Upload reports
uses: azure/CLI@v1
env:
STORAGE_NAME: pagopadweusharedtxnmsa
STORAGE_FOLDER: testfrancesco
with:
inlineScript: |
az storage blob upload-batch --overwrite true --account-name ${{ env.STORAGE_NAME }} --auth-mode key -d '${{ env.STORAGE_FOLDER }}' -s reports

notify:
needs: [ integration_test ]
runs-on: ubuntu-latest
name: Notify
if: ${{ always() && inputs.notify == 'true' }}
steps:
- name: Report Status
if: ${{ inputs.notify }}
uses: ravsamhq/notify-slack-action@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.SLACK_WEBHOOK_URL }}

# delete_github_deployments:
# runs-on: ubuntu-latest
# needs: integration_test
# if: ${{ always() }}
# steps:
# - name: Delete Previous deployments
# uses: actions/github-script@v6
# env:
# SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}}
# with:
# script: |
# const { SHA_HEAD } = process.env
#
# const deployments = await github.rest.repos.listDeployments({
# owner: context.repo.owner,
# repo: context.repo.repo,
# sha: SHA_HEAD
# });
# await Promise.all(
# deployments.data.map(async (deployment) => {
# await github.rest.repos.createDeploymentStatus({
# owner: context.repo.owner,
# repo: context.repo.repo,
# deployment_id: deployment.id,
# state: 'inactive'
# });
# return github.rest.repos.deleteDeployment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# deployment_id: deployment.id
# });
# })
# );
Loading