-
Notifications
You must be signed in to change notification settings - Fork 28
73 lines (62 loc) · 1.95 KB
/
run_tests.yml
File metadata and controls
73 lines (62 loc) · 1.95 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
name: python CI
on:
- pull_request
jobs:
tox_test:
name: Run tox (${{ matrix.python_version }})
strategy:
matrix:
python_version: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox tests
run: tox
- name: Generate coverage XML
run: |
pip install coverage
coverage xml
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
keep_history: true
build_dir: docs/build/html/.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage to Coveralls
id: coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: Unit-Test
format: cobertura
file: coverage.xml
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
continue-on-error: true
- name: Create coverage status check
if: always()
uses: actions/github-script@v6
with:
script: |
const coverage_result = '${{ steps.coveralls.outcome }}';
const conclusion = coverage_result === 'success' ? 'success' : 'neutral';
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: conclusion === 'success' ? 'success' : 'failure',
target_url: 'https://coveralls.io/github/${{ github.repository }}',
description: 'Coverage report uploaded',
context: 'coverage/coveralls'
});