Repository navigation
120 lines (109 loc) · 4.73 KB
/
Copy pathtests.yml
File metadata and controls
120 lines (109 loc) · 4.73 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
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
name: Tests
on:
# Triggers the workflow on push to any branch other than main or PR to main
# This way tests will run on any push to a feature branch and when feature
# branches are merged to main, but not repeated when PRs are actually merged.
push:
branches: [ "main" ]
paths-ignore:
- '*.md'
- '.github/**'
- '**/Contents.m'
- '**/codemeta.json'
pull_request:
branches: [ "main" ]
# Allows for manually running this workflow from the Actions tab
workflow_dispatch:
# Weekly full-model run, so the exhaustive round-trip sweep is exercised
# even in weeks without a push to main
schedule:
- cron: '0 3 * * 1'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# This workflow contains a single job called "test"
test:
name: Test openMINDS_MATLAB (${{ matrix.MATLABVersion }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
MATLABVersion: [R2022a, R2026a]
env:
LatestMATLABVersion: R2026a
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- name: Check out repo
uses: actions/checkout@v6
with:
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
# Cache the MATLAB install. A cache is restorable only from the branch
# that created it or from main, so this workflow's push, schedule and
# dispatch runs on main are what make the cache available to every pull
# request; a cache first created on a pull request is scoped to that
# pull request's merge ref and helps nobody else. The weekly schedule
# keeps it inside the seven-day eviction window in quiet weeks.
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
with:
release: ${{ matrix.MATLABVersion }}
cache: true
# The interoperability test builds the same collection with the
# Python reference implementation and compares the two exports. A
# pull request runs against a pinned release, so it cannot go red
# because of a change in the other repository. The weekly schedule
# runs against main, so drift between the implementations is noticed.
#
# The package goes into a virtual environment made from the runner's
# own Python, and the test calls that interpreter as a subprocess.
# PATH is left alone, so MATLAB's in-process Python (pyenv), which it
# resolves from PATH, stays the runner's own.
- name: Check out openMINDS_Python
uses: actions/checkout@v6
with:
repository: openMetadataInitiative/openMINDS_Python
ref: ${{ github.event_name == 'schedule' && 'main' || 'v0.6.0' }}
path: openMINDS_Python
- name: Install openMINDS_Python
run: |
python3 -m venv "${{ runner.temp }}/openminds-python"
"${{ runner.temp }}/openminds-python/bin/python" -m pip install --quiet ./openMINDS_Python
# Run all tests in the project.
# The round-trip test covers every openMINDS type when
# OPENMINDS_TEST_ALL_TYPES is set, which takes several minutes. Pull
# requests run a representative sample instead. The full sweep runs
# on push to main, which is where the openMINDS pipeline lands
# regenerated type classes, and on the weekly schedule.
- name: Run tests
if: always()
uses: matlab-actions/run-command@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENMINDS_TEST_ALL_TYPES: ${{ (github.event_name == 'pull_request') && '0' || '1' }}
OPENMINDS_PYTHON: ${{ runner.temp }}/openminds-python/bin/python
with:
command: |
addpath(genpath("tools"));
testToolbox()
- name: Upload code coverage report to Codecov (https://app.codecov.io/gh/openMetadataInitiative/openMINDS_MATLAB)
if: matrix.MATLABVersion == env.LatestMATLABVersion
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: docs/reports/codecoverage.xml
# Publish test results
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "docs/reports/test-results.xml"
check_name: "Test Results (${{ matrix.MATLABVersion }})"
# Save the contents of the reports directory as an artifact
- name: Save reports directory
uses: actions/upload-artifact@v7
if: always()
with:
name: reports-${{ matrix.MATLABVersion }}
path: docs/reports