-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (110 loc) · 4.12 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
107
108
109
110
111
112
113
name: Horace-Euphonic-Interface Tests
on:
push:
branches: [master]
pull_request:
branches: [master, development]
types: [opened, reopened, synchronize]
workflow_dispatch:
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
matlab_version: [latest]
python_version: [3.9]
euphonic_version: ['']
# Test lowest supported Python/Euphonic versions, and lowest available Matlab
include:
- os: ubuntu-latest
matlab_version: R2021a
python_version: 3.9
euphonic_version: '--version 1.3.1'
fail-fast: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0} # Needed to use conda environments
steps:
- name: Check out Horace-Euphonic-Interface
uses: actions/checkout@v3
with:
submodules: true
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2 # v1.1.0 required for Windows/MacOS support
with:
release: ${{ matrix.matlab_version }}
- name: Set up Python
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python_version }}
- name: Set Python environment variable for access by Matlab
if: ${{ matrix.os != 'windows-latest' }}
run: echo "PYTHON_EX_PATH=`which python`" >> $GITHUB_ENV
- name: Set Python environment variable for access by Matlab (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: powershell
run: |
$pypath = (Get-Command python).Path
echo "PYTHON_EX_PATH=$pypath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Update pip and create Matlab toolbox
run: |
python -m pip install --upgrade pip &&
python -m pip install requests &&
python create_mltbx.py
- name: Install base Euphonic
run: |
python -m pip install numpy &&
python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version }}
python create_mltbx.py
- name: Run tests with base Euphonic
uses: matlab-actions/run-command@v2
with:
command: cd('test'); set_up_dependencies; run_tests('not', 'phonopy_reader', 'not', 'brille')
- name: Install Euphonic phonopy_reader
if: always()
run: python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version}} --extras phonopy_reader
- name: Run tests with Euphonic and phonopy_reader
if: always()
uses: matlab-actions/run-command@v2
with:
command: cd('test'); set_up_dependencies; run_tests('phonopy_reader')
- name: Install brille
if: always()
run: python euphonic_sqw_models/apply_requirements.py ${{ matrix.euphonic_version}} --extras brille
- name: Run tests with Euphonic and Brille
if: always()
uses: matlab-actions/run-command@v2
with:
command: cd('test'); set_up_dependencies; run_tests('brille')
- uses: codecov/codecov-action@v3
if: ${{ always() && matrix.os == 'ubuntu-latest' && matrix.matlab_version == 'latest' }}
with:
directory: test
files: coverage*.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload toolbox
if: ${{ always() && matrix.os == 'ubuntu-latest' && matrix.matlab_version == 'latest' }}
uses: actions/upload-artifact@v3
with:
name: horace_euphonic_interface.mltbx
path: mltbx/horace_euphonic_interface.mltbx
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: Unit test results ${{ matrix.os }}
path: test/junit_report*.xml
publish-test-results:
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: artifacts/**/junit_report*.xml