-
Notifications
You must be signed in to change notification settings - Fork 7
142 lines (121 loc) · 3.5 KB
/
pydesigner_ci.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
pull_request:
push:
branches: master
tags:
- "**"
permissions:
checks: write
pull-requests: write
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_BRIDGE_PAT }}
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: 'x64'
- name: Run Pre-Commit
id: pre-commit
uses: pre-commit/[email protected]
continue-on-error: true
with:
extra_args: --all-files
- name: Auto-commit changed files
id: git-auto-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Pre-commit autofix"
- name: Return pre-commit response
if: steps.pre-commit.outcome == 'failure'
run: exit 1
pytest:
needs: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BRIDGE_PAT }}
- name: Login to Docker Hub
id: login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker image
run: docker build -t pydesigner-test -f tests/Dockerfile .
- name: Run tests in Docker container
run: docker run --name pydesigner-test-container pydesigner-test
- name: Copy test results
if: always()
run: docker cp pydesigner-test-container:/test_results/ ./test_results
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: ./test_results/results.xml
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./test_results/coverage.xml
- name: Clean up
run: |
docker container rm pydesigner-test-container
docker image rm pydesigner-test
summary-reports:
needs: pytest
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BRIDGE_PAT }}
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: ./test_results
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: ./test_results
- name: Code coverage summary report
uses: irongut/[email protected]
with:
filename: ./test_results/coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '10 50'
- name: Publish Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
- name: Output Coverage to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: |
test_results/results.xml