-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (75 loc) · 2.32 KB
/
testing.yaml
File metadata and controls
89 lines (75 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Testing
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
permissions:
contents: read
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up workspace
uses: ./.github/actions/setup-workspace
- name: Run unit tests with coverage
run: |
poetry run coverage run -m pytest
poetry run coverage report > coverage.txt
poetry run coverage html
- name: Create GHA job summary
if: always()
run: |
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
echo "# FizzBuzz API Unit Testing Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Pytest coverage" >> $GITHUB_STEP_SUMMARY
echo '```text' >> $GITHUB_STEP_SUMMARY
cat coverage.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage files
if: success()
id: upload-pages
uses: actions/upload-pages-artifact@v3
with:
path: coverage_html/
feature-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up workspace
uses: ./.github/actions/setup-workspace
- name: Run Gherkin tests
run: |
just behave ./tests/features/feature_tests/api_features > behaviors.txt
- name: Create GHA job summary
if: always()
run: |
echo "# FizzBuzz API Feature Testing Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Pytest coverage" >> $GITHUB_STEP_SUMMARY
echo '```console' >> $GITHUB_STEP_SUMMARY
cat behaviors.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: coverage
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Post report URL
if: success()
run: |
echo "Coverage report: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY