Skip to content

Checks and unit tests for empty jira payloads (#330) #891

Checks and unit tests for empty jira payloads (#330)

Checks and unit tests for empty jira payloads (#330) #891

name: Testops Check All Jobs on Push
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
push:
branches: [ master ]
workflow_dispatch:
inputs:
branchName:
description: "Default branch"
required: true
default: "master"
permissions:
contents: read
env:
CLOUD_SQL_DATABASE_NAME: preflight
CLOUD_SQL_DATABASE_USERNAME: ${{ secrets.CLOUD_SQL_DATABASE_USERNAME }}
CLOUD_SQL_DATABASE_PASSWORD: ${{ secrets.CLOUD_SQL_DATABASE_PASSWORD }}
CLOUD_SQL_DATABASE_PORT: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}
TESTRAIL_HOST: ${{ secrets.TESTRAIL_HOST }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
TESTRAIL_PASSWORD: ${{ secrets.TESTRAIL_PASSWORD }}
ATLASSIAN_API_TOKEN: ${{ secrets.ATLASSIAN_API_TOKEN }}
ATLASSIAN_HOST: ${{ secrets.ATLASSIAN_HOST }}
ATLASSIAN_USERNAME: ${{ secrets.ATLASSIAN_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUGZILLA_API_KEY: ${{ secrets.BUGZILLA_API_KEY }}
BITRISE_HOST: ${{ secrets.BITRISE_HOST }}
BITRISE_APP_SLUG: ${{ secrets.BITRISE_APP_SLUG }}
BITRISE_TOKEN: ${{ secrets.BITRISE_TOKEN }}
SENTRY_HOST: ${{ secrets.SENTRY_HOST }}
SENTRY_API_TOKEN: ${{ secrets.SENTRY_API_TOKEN_CSO }}
SENTRY_ORGANIZATION_SLUG: ${{ secrets.SENTRY_ORGANIZATION_SLUG }}
SENTRY_IOS_PROJECT_ID: ${{ secrets.SENTRY_IOS_PROJECT_ID }}
SENTRY_FENIX_PROJECT_ID: ${{ secrets.SENTRY_FENIX_PROJECT_ID }}
SENTRY_FENIX_BETA_PROJECT_ID: ${{ secrets.SENTRY_FENIX_BETA_PROJECT_ID }}
jobs:
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: requirements.txt
- run: pip install -r requirements.txt
- name: Run Jira API Client Tests
run: python -m unittest tests.test_jira_api_client -v --buffer
reports:
name: Run reports (${{ matrix.name }})
runs-on: ubuntu-latest
# Gate Dependabot PRs unless a repo member applied the label.
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.user.login != 'dependabot[bot]'
|| (
github.event.action == 'labeled'
&& github.event.label.name == 'run-testops'
)
needs: [unit-tests]
strategy:
fail-fast: false
max-parallel: 6
matrix:
include:
- name: Mobile Test Case Coverage
args: --report-type testrail-test-case-coverage --platform mobile --project ALL
- name: Desktop Test Case Coverage
args: --report-type testrail-test-case-coverage --platform desktop --project ALL
- name: Desktop Test Plans and Runs
args: --platform desktop --project firefox-desktop --report-type testrail-test-plans-and-runs --num-days 30
- name: Testrail Users
args: --report-type testrail-users
- name: Mobile Testrail Milestones
args: --platform mobile --project ALL --report-type testrail-milestones
- name: Jira qa-needed
args: --report-type jira-qa-needed
- name: Jira qa-requests
args: --report-type jira-qa-requests
- name: Jira Softvision Worklogs
args: --report-type jira-softvision-worklogs
- name: Bugzilla qe-verify
args: --report-type bugzilla-qe-verify
- name: Bugzilla Metabug Android Memory Leaks
args: --report-type bugzilla-meta-bugs --meta-bug-id 1935100
- name: Bugzilla Desktop Bugs
args: --report-type bugzilla-desktop-bugs
- name: Bugzilla Android UI Tests Bugs Caught
args: --report-type bugzilla-query-by-keyword --bz-keyword "ui-test-bug-auto-found"
- name: Bitrise Build Count
args: --platform mobile --project firefox-ios --report-type bitrise-builds
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: requirements.txt
- uses: mattes/gce-cloudsql-proxy-action@v1
with:
creds: ${{ secrets.GCLOUD_AUTH }}
instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }}
port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}
proxy_version: "1.37.11"
- run: pip install -r requirements.txt
- run: python ./__main__.py ${{ matrix.args }}
fetch-github-issues:
name: New Github issues
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.user.login != 'dependabot[bot]'
|| (
github.event.action == 'labeled'
&& github.event.label.name == 'run-testops'
)
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: "pip"
cache-dependency-path: requirements.txt
- run: pip install -r requirements.txt
- uses: mattes/gce-cloudsql-proxy-action@v1
with:
creds: ${{ secrets.GCLOUD_AUTH }}
instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }}
port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}
proxy_version: "1.37.11"
- name: Fetch Github Issues
run: |
python __main__.py --report-type github-issues --project firefox-ios --num-days 8
- uses: actions/upload-artifact@v7
with:
name: github_new_issues
path: ./github_new_bugs_firefox-ios_*.csv
- name: Construct Slack report
run: |
python -m api.github.utils github_new_bugs_firefox-ios_*.csv > github-new-issues-slack.json
sentry:
name: Sentry reports
runs-on: ubuntu-latest
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.user.login != 'dependabot[bot]'
|| (
github.event.action == 'labeled'
&& github.event.label.name == 'run-testops'
)
needs: [unit-tests]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: requirements.txt
- uses: mattes/gce-cloudsql-proxy-action@v1
with:
creds: ${{ secrets.GCLOUD_AUTH }}
instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }}
port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}
proxy_version: "1.37.11"
- run: pip install -r requirements.txt
- name: Sentry query (iOS)
run: |
python __main__.py --report-type sentry-issues --project firefox-ios
python __main__.py --report-type sentry-rates --project firefox-ios
- uses: actions/upload-artifact@v7
with:
name: sentry_issues_firefox_ios
path: ./sentry_issues_firefox-ios_*.csv
- name: Construct JSON for Slack (iOS)
run: python -m api.sentry.utils --file ./sentry_rates.csv --project firefox-ios
- name: Sentry query (Android)
run: |
python __main__.py --report-type sentry-issues --project fenix
python __main__.py --report-type sentry-rates --project fenix
- uses: actions/upload-artifact@v7
with:
name: sentry_issues_fenix
path: ./sentry_issues_fenix_*.csv
- name: Construct JSON for Slack (Android)
run: python -m api.sentry.utils --file ./sentry_rates.csv --project fenix
- name: Sentry query (Android Beta)
run: |
python __main__.py --report-type sentry-issues --project fenix-beta
python __main__.py --report-type sentry-rates --project fenix-beta
continue-on-error: true
- uses: actions/upload-artifact@v7
with:
name: sentry_issues_fenix-beta
path: ./sentry_issues_fenix-beta_*.csv
- name: Construct JSON for Slack (Android Beta)
run: python -m api.sentry.utils --file ./sentry_rates.csv --project fenix-beta
notify:
name: Slack notify
runs-on: ubuntu-latest
needs: [reports, sentry, unit-tests]
if: >-
always() &&
(needs.reports.result != 'skipped' || needs.sentry.result != 'skipped')
steps:
- uses: actions/checkout@v6
- run: echo "JOB_LOG_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
- uses: slackapi/slack-github-action@v3.0.1
env:
WORKFLOW_NAME: ${{ github.workflow }}
BRANCH: ${{ github.head_ref || github.ref_name }}
JOB_STATUS: ${{ (needs.unit-tests.result == 'success' && needs.reports.result == 'success' && needs.sentry.result == 'success') && ':white_check_mark:' || ':x:' }}
JOB_STATUS_COLOR: ${{ (needs.unit-tests.result == 'success' && needs.reports.result == 'success' && needs.sentry.result == 'success') && '#36a64f' || '#FF0000' }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_MOBILE_ALERTS_TOOLING }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL_MOBILE_ALERTS_TOOLING }}
webhook-type: webhook-trigger
payload-file-path: "./config/payload-slack-content.json"
payload-templated: true