-
Notifications
You must be signed in to change notification settings - Fork 13
executable file
·88 lines (84 loc) · 2.8 KB
/
run-tests-action.yaml
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
name: pytest
on: push
jobs:
run_pytest:
name: run-tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
os: ["ubuntu-latest"]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: tests/test-env.yml
python: ${{ matrix.python-version }}
channels: conda-forge,phygbu
channel-priority: flexible
activate-environment: test-environment
auto-activate-base: false
- name: Conda information
run: |
conda info
conda list
conda config --show-sources
conda config --show
- name: install package
run: pip install --no-deps .
- name: Install headless server
run: |
sudo apt-get install xvfb
sudo apt-get install qtbase5-dev
- name: Test with xvfb
run: xvfb-run --auto-servernum ${MAMBA_ROOT_PREFIX}/envs/test-environment/bin/pytest --cov-report=xml:cov.xml --cov=Stoner --junitxml pytest.xml
env:
TZ: Europe/London
LC_CTYPE: en_GB.UTF-8
GH_ACTION: True
- name: Cleanup X11 server
uses: bcomnes/cleanup-xvfb@v1
- name: Run Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel: true
flag-name: python-${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (Python ${{ matrix.python-version }})
path: pytest.xml
- name: Post Coveraage result to Codacy
run: |
export CODACY_PROJECT_TOKEN=${{ secrets.CODACY_PROJECT_TOKEN }}
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cov.xml
publish-test-results:
name: "Publish Unit Tests Results"
needs: run_pytest
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
coverage-finish:
needs: run_pytest
runs-on: ubuntu-latest
steps:
- name: Finish colveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true