Skip to content

Commit c6d6bee

Browse files
authored
Add actions step for nightly reporting -> Testrail (#774)
1 parent 2061e61 commit c6d6bee

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

.github/workflows/pytest.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
pull_request:
88
release:
99
types: [published]
10+
schedule:
11+
- cron: "0 8 * * *"
1012

1113
jobs:
1214
build:
@@ -124,6 +126,7 @@ jobs:
124126
DEPLOY_SHINYAPPS_SECRET: "${{ secrets.DEPLOY_SHINYAPPS_SECRET }}"
125127
run: |
126128
make e2e-deploys
129+
127130
pypi:
128131
name: "Deploy to PyPI"
129132
runs-on: ubuntu-latest
@@ -160,3 +163,56 @@ jobs:
160163
with:
161164
user: __token__
162165
password: ${{ secrets.PYPI_API_TOKEN }}
166+
167+
testrail-reporting-nightly:
168+
runs-on: ${{ matrix.os }}
169+
if: ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'testrail')) }}
170+
strategy:
171+
matrix:
172+
python-version:
173+
- "3.11"
174+
- "3.10"
175+
- "3.9"
176+
# - "3.8" # Testrail has errors when running on python 3.8; Skipping
177+
os: [ubuntu-latest]
178+
fail-fast: false
179+
180+
steps:
181+
- uses: actions/checkout@v3
182+
- name: Setup py-shiny
183+
uses: ./.github/py-shiny/setup
184+
with:
185+
python-version: ${{ matrix.python-version }}
186+
187+
- name: Install node.js
188+
uses: actions/setup-node@v3
189+
with:
190+
node-version: "18"
191+
cache: npm
192+
cache-dependency-path: examples/brownian/shinymediapipe/package-lock.json
193+
- name: Install node.js package
194+
working-directory: examples/brownian/shinymediapipe
195+
run: |
196+
npm ci
197+
198+
- name: Run End-to-End tests
199+
run: |
200+
make e2e-junit
201+
- name: Report results to Testrail
202+
env:
203+
TESTRAIL_URL: "https://posit.testrail.io"
204+
TESTRAIL_PROJECT: "Shiny-Python"
205+
TESTRAIL_USER: "${{ secrets.TESTRAIL_USER }}"
206+
TESTRAIL_PASSWORD: "${{ secrets.TESTRAIL_PASSWORD }}"
207+
run: |
208+
CURRENT_DATE="$(date +'%Y-%m-%d %H:%M:%S') Nightly tests"
209+
trcli \
210+
--yes \
211+
--host "$TESTRAIL_URL" \
212+
--project "$TESTRAIL_PROJECT" \
213+
--username "$TESTRAIL_USER" \
214+
--password "$TESTRAIL_PASSWORD" \
215+
parse_junit \
216+
--file "report.xml" \
217+
--title "$CURRENT_DATE" \
218+
--close-run

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ DEPLOYS_FILE:=tests/deploys
9191
playwright-install:
9292
playwright install --with-deps
9393

94+
trcli-install:
95+
which trcli || pip install trcli
96+
9497
e2e: playwright-install ## end-to-end tests with playwright
9598
pytest $(FILE) -m "not examples and not integrationtest"
9699

@@ -100,6 +103,9 @@ e2e-examples: playwright-install ## end-to-end tests on examples with playwright
100103
e2e-deploys: playwright-install ## end-to-end tests on deploys with playwright
101104
pytest $(DEPLOYS_FILE) -s -m "integrationtest"
102105

106+
e2e-junit: playwright-install trcli-install ## end-to-end tests with playwright and generate junit report
107+
pytest $(FILE) --junitxml=report.xml
108+
103109
coverage: ## check combined code coverage (must run e2e last)
104110
pytest --cov-report term-missing --cov=shiny tests/pytest/ tests/e2e/ -m "not examples and not integrationtest"
105111
coverage html

0 commit comments

Comments
 (0)