Skip to content

Commit ae994a7

Browse files
committed
add workflow
1 parent dadaa2f commit ae994a7

2 files changed

Lines changed: 122 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Run report and verify inserts
2+
description: Runs a command, parses ROWS_INSERTED=N, and enforces zero policy
3+
4+
inputs:
5+
report_name:
6+
description: Logical name of the report (for messages)
7+
required: true
8+
run:
9+
description: Shell command to run the report (must print ROWS_INSERTED=N)
10+
required: true
11+
zero_ok:
12+
description: 'Allow zero inserts without failing (true/false)'
13+
required: false
14+
default: 'false'
15+
parse_regex:
16+
description: RegEx to capture ROWS_INSERTED=NNN (advanced override)
17+
required: false
18+
default: '^ROWS_INSERTED=([0-9]+)$'
19+
20+
runs:
21+
using: composite
22+
steps:
23+
- name: Run report
24+
id: runreport
25+
shell: bash
26+
run: |
27+
set -euo pipefail
28+
echo "[verify] running: ${{ inputs.run }}"
29+
bash -lc '${{ inputs.run }}' | tee report.out
30+
# Find last ROWS_INSERTED line; default 0 if absent
31+
count=$(grep -Eo "${{ inputs.parse_regex }}" report.out | sed -E 's/.*=([0-9]+).*//' | tail -n1 || true)
32+
if [[ -z "${count:-}" ]]; then count=0; fi
33+
echo "rows_inserted=${count}" >> "$GITHUB_OUTPUT"
34+
35+
- name: Enforce non-zero inserts
36+
if: steps.runreport.outputs.rows_inserted == '0' && inputs.zero_ok != 'true'
37+
shell: bash
38+
run: |
39+
echo "::error::Report '${{ inputs.report_name }}' expected inserts but got 0"
40+
exit 1
41+
42+
- name: Diagnostic (zero allowed)
43+
if: steps.runreport.outputs.rows_inserted == '0' && inputs.zero_ok == 'true'
44+
shell: bash
45+
run: |
46+
echo "::warning::Report '${{ inputs.report_name }}' inserted 0 rows (allowed)"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Testops Check All Jobs on Push
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- rpapa-db-verify
8+
workflow_dispatch:
9+
inputs:
10+
branchName:
11+
description: 'Default branch'
12+
required: true
13+
default: 'master'
14+
15+
jobs:
16+
deploy:
17+
name: Testops Check All Jobs on Push
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check out source repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Establish Cloud SQL Proxy
30+
uses: mattes/gce-cloudsql-proxy-action@v1
31+
with:
32+
creds: ${{ secrets.GCLOUD_AUTH }}
33+
instance: ${{ secrets.CLOUD_SQL_CONNECTION_NAME }}
34+
port: ${{ secrets.CLOUD_SQL_DATABASE_PORT }}
35+
36+
- name: Install requirements
37+
run: |
38+
pip install -r requirements.txt
39+
40+
- name: Set env vars
41+
run: |
42+
echo "CLOUD_SQL_DATABASE_USERNAME=${{ secrets.CLOUD_SQL_DATABASE_USERNAME }}" >> $GITHUB_ENV
43+
echo "CLOUD_SQL_DATABASE_PASSWORD=${{ secrets.CLOUD_SQL_DATABASE_PASSWORD }}" >> $GITHUB_ENV
44+
echo "CLOUD_SQL_DATABASE_NAME=preflight" >> $GITHUB_ENV
45+
echo "CLOUD_SQL_DATABASE_PORT=${{ secrets.CLOUD_SQL_DATABASE_PORT }}" >> $GITHUB_ENV
46+
echo "TESTRAIL_HOST=${{ secrets.TESTRAIL_HOST }}" >> $GITHUB_ENV
47+
echo "TESTRAIL_USERNAME=${{ secrets.TESTRAIL_USERNAME }}" >> $GITHUB_ENV
48+
echo "TESTRAIL_PASSWORD=${{ secrets.TESTRAIL_PASSWORD }}" >> $GITHUB_ENV
49+
echo "ATLASSIAN_API_TOKEN=${{ secrets.ATLASSIAN_API_TOKEN }}" >> $GITHUB_ENV
50+
echo "ATLASSIAN_HOST=${{ secrets.ATLASSIAN_HOST }}" >> $GITHUB_ENV
51+
echo "ATLASSIAN_USERNAME=${{ secrets.ATLASSIAN_USERNAME }}" >> $GITHUB_ENV
52+
echo "JIRA_HOST=${{ secrets.JIRA_HOST }}" >> $GITHUB_ENV
53+
echo "JIRA_USER=${{ secrets.JIRA_USER }}" >> $GITHUB_ENV
54+
echo "JIRA_PASSWORD=${{ secrets.JIRA_PASSWORD }}" >> $GITHUB_ENV
55+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
56+
echo "BUGZILLA_API_KEY=${{ secrets.BUGZILLA_API_KEY }}" >> $GITHUB_ENV
57+
echo "BITRISE_HOST=${{ secrets.BITRISE_HOST }}" >> $GITHUB_ENV
58+
echo "BITRISE_APP_SLUG=${{ secrets.BITRISE_APP_SLUG }}" >> $GITHUB_ENV
59+
echo "BITRISE_TOKEN=${{ secrets.BITRISE_TOKEN }}" >> $GITHUB_ENV
60+
echo "SENTRY_HOST=${{ secrets.SENTRY_HOST }}" >> $GITHUB_ENV
61+
echo "SENTRY_API_TOKEN=${{ secrets.SENTRY_API_TOKEN_CSO }}" >> $GITHUB_ENV
62+
echo "SENTRY_ORGANIZATION_SLUG=${{ secrets.SENTRY_ORGANIZATION_SLUG }}" >> $GITHUB_ENV
63+
echo "SENTRY_PROJECT_ID=${{ secrets.SENTRY_PROJECT_ID }}" >> $GITHUB_ENV
64+
65+
# TestRail
66+
- name: Mobile Test Case Coverage & DB verify
67+
uses: ./.github/actions/db-inserts-verify
68+
with:
69+
report_name: Mobile Test Case Coverage
70+
run: python ./__main__.py --report-type testrail-test-case-coverage --platform mobile --project ALL
71+
zero_ok: 'false'
72+
require_delete: 'false'
73+
74+
#- name: Mobile testrail milestones
75+
# run: python3 ./__main__.py --platform mobile --project ALL --report-type testrail-milestones
76+

0 commit comments

Comments
 (0)