-
Notifications
You must be signed in to change notification settings - Fork 11
106 lines (103 loc) · 3.49 KB
/
run_tests.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
name: run-tests
on:
push:
branches:
- '**master**'
- '**_run_ci**'
- '**release**'
pull_request:
types: [opened, reopened, labeled, synchronize]
workflow_dispatch:
jobs:
test:
if: |
github.event_name != 'pull_request' ||
(github.event.action == 'labeled' && github.event.label.name == 'run_ci') ||
(github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no_ci'))
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
channels: conda-forge,defaults
channel-priority: true
- name: Install llvm on Macos
if: startsWith(matrix.os, 'macos')
run: |
brew install llvm
- name: Update pip and install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install -r tests_and_analysis/ci_requirements.txt
- name: Run tests, skip Python 3.11 unless workflow dispatch
if: github.event_name != 'workflow_dispatch'
env:
TOX_SKIP_ENV: '.*?(py311).*?'
shell: bash -l {0}
run: python -m tox
- name: Run tests, workflow dispatch so test all Python versions
if: github.event_name == 'workflow_dispatch'
shell: bash -l {0}
run: python -m tox
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit test results ${{ matrix.os }}
path: tests_and_analysis/test/reports/junit_report*.xml
- name: Publish Codacy coverage
uses: codacy/codacy-coverage-reporter-action@v1
if: startsWith(matrix.os, 'ubuntu')
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: tests_and_analysis/test/reports/coverage*.xml
- uses: codecov/codecov-action@v3
if: startsWith(matrix.os, 'ubuntu')
with:
files: tests_and_analysis/test/reports/coverage*.xml
test-docs:
runs-on: ubuntu-latest
if: success() || failure()
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.10'
channels: conda-forge,defaults
channel-priority: true
- name: Update pip and install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install -r tests_and_analysis/ci_requirements.txt
python -m pip install -r doc/requirements.txt
python -m pip install .[matplotlib,phonopy_reader,brille]
- name: Run Sphinx doctests
working-directory: ./doc
shell: bash -l {0}
run: sphinx-build -c source -b doctest source .
- name: Upload docstest results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Doctest results
path: doc/output.txt
publish-test-results:
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: artifacts/**/junit_report*.xml