Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFRA] run matlab CI on all OS #47

Merged
merged 9 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
# Documentation
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'monthly'
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

- package-ecosystem: 'gitsubmodule'
directory: '/'
schedule:
interval: 'monthly'
- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: monthly
1 change: 1 addition & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
template: |
## Release Notes

Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/codespell.yml

This file was deleted.

98 changes: 57 additions & 41 deletions .github/workflows/run_tests_matlab.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,73 @@
---
name: tests and coverage with matlab

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:

push:
branches:
- master
- dev
- master
- dev

pull_request:
branches: ["*"]
branches: ['*']

jobs:

build:

runs-on: ubuntu-22.04
strategy:
matrix:
version: [R2021a, R2021b, R2022a, R2022b]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false # Don't cancel all jobs if one fails

runs-on: ${{ matrix.os }}

steps:

- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1.2.4
with:
# MATLAB release to set up R2020a
release: R2020a

- name: Clone spm_2_bids
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 2

- name: Install Moxunit and MOcov
run: |
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
git clone https://github.com/MOcov/MOcov.git --depth 1

- name: get bids-matlab and JSONio
run: make install_dev

- name: Run commands
uses: matlab-actions/run-command@v1.1.3
with:
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;

- name: Run tests
run: |
cat test_report.log | grep 0
bash <(curl -s https://codecov.io/bash)

- name: Code coverage
uses: codecov/codecov-action@v3
with:
file: coverage.xml # optional
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: false # optional (default = false)
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v1.2.4
with:
release: ${{ matrix.version }}

- name: Clone spm_2_bids
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 2

- name: Install Moxunit and MOcov
run: |
git clone https://github.com/MOxUnit/MOxUnit.git --depth 1
git clone https://github.com/MOcov/MOcov.git --depth 1

- name: get bids-matlab and JSONio
run: make install_dev

- name: Run commands
uses: matlab-actions/run-command@v1.1.3
with:
command: cd(fullfile(getenv('GITHUB_WORKSPACE'), '.github', 'workflows')); run tests_matlab;

- name: Check logs unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: grep -q 0 test_report.log || { echo "Some tests failed. Check the 'Run tests' step to know which ones." >&2; exit 1; }
- name: Check logs windows
if: matrix.os == 'windows-latest'
run: |
if (-not (Get-Content test_report.log | Select-String -Pattern "0")) {
throw "Some tests failed. Check the 'Run tests' step to know which ones."
}

- name: Code coverage
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
uses: codecov/codecov-action@v3
with:
file: coverage.xml
flags: ${{ matrix.os }}_matlab-${{ matrix.version }}
with_coverage: true
cover_xml_file: coverage.xml
20 changes: 17 additions & 3 deletions .github/workflows/run_tests_octave.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
name: tests_octave

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
- dev
- master
- dev
pull_request:
branches: ['*']

Expand Down Expand Up @@ -35,4 +40,13 @@ jobs:
tests: tests
src: src src/defaults src/utils
ext: lib/JSONio lib/bids-matlab tests/utils
with_coverage: false
with_coverage: true
cover_xml_file: coverage.xml

- name: Code coverage
uses: codecov/codecov-action@v3
with:
file: coverage.xml
flags: ubuntu-latest_octave
name: codecov-umbrella
fail_ci_if_error: true
7 changes: 4 additions & 3 deletions .github/workflows/validate_cff.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
name: validate CITATION.cff

on:
push:
branches: ['*']
paths:
- 'CITATION.cff'
- CITATION.cff
pull_request:
branches: ['*']
paths:
- 'CITATION.cff'
- CITATION.cff

jobs:

Expand All @@ -23,4 +24,4 @@ jobs:
- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/cffconvert-github-action@2.0.0
with:
args: "--validate"
args: --validate
84 changes: 48 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
---
repos:

- repo: local

hooks:

- id: mh_style
name: mh_style
entry: mh_style
args: [--process-slx, --fix]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_metric
name: mh_metric
entry: mh_metric
args: [--ci]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_lint
name: mh_lint
entry: mh_lint
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit]
- repo: local

hooks:

- id: mh_style
name: mh_style
entry: mh_style
args: [--process-slx, --fix]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_metric
name: mh_metric
entry: mh_metric
args: [--ci]
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit_core]

- id: mh_lint
name: mh_lint
entry: mh_lint
files: ^(.*\.(m|slx))$
language: python
additional_dependencies: [miss_hit]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks # Detect common mistake of using single backticks when writing rst
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks # Detect common mistake of using single backticks when writing rst
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.2
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0']
1 change: 1 addition & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
dependencies:
- octave_kernel
25 changes: 17 additions & 8 deletions run_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,35 @@

thisDir = fullfile(fileparts(mfilename('fullpath')));

folderToCover = fullfile(thisDir, 'src');
addpath(genpath(folderToCover));

if isdir(fullfile(thisDir, 'lib', 'bids-matlab'))
addpath(fullfile(thisDir, 'lib', 'bids-matlab'));
end
if isdir(fullfile(thisDir, 'lib', 'JSONio'))
addpath(fullfile(thisDir, 'lib', 'JSONio'));
end

folderToCover = fullfile(thisDir, 'src');
testFolder = fullfile(thisDir, 'tests');

addpath(fullfile(testFolder, 'utils'));

success = moxunit_runtests(testFolder, ...
'-verbose', '-recursive', '-with_coverage', ...
'-cover', folderToCover, ...
'-cover_xml_file', 'coverage.xml', ...
'-cover_html_dir', fullfile(pwd, 'coverage_html'));
if ispc
success = moxunit_runtests(testFolder, '-verbose');

else
success = moxunit_runtests(testFolder, ...
'-verbose', '-recursive', '-with_coverage', ...
'-cover', folderToCover, ...
'-cover_xml_file', 'coverage.xml', ...
'-cover_html_dir', fullfile(pwd, 'coverage_html'));
end

fileID = fopen('test_report.log', 'w');
if success
system('echo 0 > test_report.log');
fprintf(fileID, '0');
else
system('echo 1 > test_report.log');
fprintf(fileID, '1');
end
fclose(fileID);
Loading