Skip to content

Commit

Permalink
Add daily task to query TestRail and populate DDBB
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelrios committed Jul 23, 2024
1 parent 8444a44 commit 0c22d5e
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/production-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Testops Report DAILY

# Daily @8am UTC
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
inputs:
branchName:
description: 'Default branch'
required: true
default: 'master'

jobs:
deploy:
name: Jira TestOps Report (DAILY)
runs-on: ubuntu-latest

steps:
- name: Check out source repository
uses: actions/checkout@v2

- name: Setup python
uses: actions/setup-python@v1

- name: Establish Cloud SQL Proxy
uses: mattes/gce-cloudsql-proxy-action@v1
with:
creds: ${{ secrets.GCLOUD_AUTH }}
instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }}
port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}

- name: Install requirements
run: pip install -r requirements.txt

- name: Set env vars
run: |
echo "CLOUD_SQL_DATABASE_USERNAME=${{ secrets.CLOUD_SQL_DATABASE_USERNAME }}" >> $GITHUB_ENV
echo "CLOUD_SQL_DATABASE_PASSWORD=${{ secrets.CLOUD_SQL_DATABASE_PASSWORD }}" >> $GITHUB_ENV
echo "CLOUD_SQL_DATABASE_NAME=production" >> $GITHUB_ENV
echo "CLOUD_SQL_DATABASE_PORT=${{ secrets.CLOUD_SQL_DATABASE_PORT }}" >> $GITHUB_ENV
echo "TESTRAIL_HOST=${{ secrets.TESTRAIL_HOST }}" >> $GITHUB_ENV
echo "TESTRAIL_USERNAME=${{ secrets.TESTRAIL_USERNAME }}" >> $GITHUB_ENV
echo "TESTRAIL_PASSWORD=${{ secrets.TESTRAIL_PASSWORD }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Jira query
run: python ./__main__.py --report-type jira-qa-requests

- name: Jira query
if: always()
run: python ./__main__.py --report-type jira-qa-needed

- name: Set job log URL
if: always()
run: echo "JOB_LOG_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
- name: Send custom JSON data to Slack workflow
if: always()
id: slack
uses: slackapi/[email protected]
env:
JOB_STATUS: ${{ job.status == 'success' && ':white_check_mark:' || job.status == 'failure' && ':x:' }}
JOB_STATUS_COLOR: ${{ job.status == 'success' && '#36a64f' || job.status == 'failure' && '#FF0000' }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

with:
payload-file-path: "./payload-slack-content.json"

0 comments on commit 0c22d5e

Please sign in to comment.