Skip to content

Commit

Permalink
Add GitHub Actions CI builds
Browse files Browse the repository at this point in the history
Resolves #180

**Why this change was necessary**
Travis doesn't offer great support for macOS and is also beginning to
charge for macOS build minutes[1].

**What this change does**
 - Factors the Travis CI build config into a GH Actions Workflow
 - Adds a matrix build in the GH Actions Workflow for macOS 10.15
 Catalina and 11.0 Big Sur (on Apple Silicon), and Ubuntu 18, 20, and
 16
 - Adds a matrix build in the GH Actions Workflow for Python 3.7 and
 3.8
 - Adds a build status badge to the README
 - Adds Coveralls parallel build coverage metrics[2]

**Additional context/notes/links**
[1] https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing
[2] https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-gotcha
  • Loading branch information
jidicula committed Dec 1, 2020
1 parent aa10af2 commit 007bac1
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 73 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: CI-Tests

on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test:
env:
FSLOUTPUTTYPE: NIFTI_GZ
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'macos-10.15'
- 'macos-11.0'
- 'ubuntu-18.04'
- 'ubuntu-20.04'
- 'ubuntu-16.04'
python-version:
- '3.7'
- '3.8'

steps:
- uses: actions/checkout@v2

- name: Set XCode version
if: contains(matrix.os, 'macos-11.0')
run: sudo xcode-select -s "/Applications/Xcode_12.2.app"

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Package installation
run: |
echo "shimming-toolbox installation"
pip install .
- name: dcm2niix macOS
if: contains(matrix.os, 'macos')
run: brew install dcm2niix

- name: dcm2niix Ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
curl -JLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_lnx.zip
unzip -o dcm2niix_lnx.zip
sudo install dcm2nii* /usr/bin/
- name: prelude macOS
if: contains(matrix.os, 'macos')
run: |
echo "Download prelude for macOS"
mkdir prelude
curl -o prelude/prelude -JL https://github.com/shimming-toolbox/binaries/raw/master/prelude_macos
sudo install prelude/prelude /usr/local/bin
- name: prelude Ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
echo "Download prelude"
st_download_data prelude
sudo install prelude/prelude /usr/local/bin
- name: Check dependencies
run: st_check_dependencies

- name: Run unit tests
run: py.test . -v --cov shimmingtoolbox/ --cov-report term-missing

- name: macOS Shellcheck
if: contains(matrix.os, 'macos')
run: brew install shellcheck

- name: Shellcheck
run: |
echo "Check Bash scripts"
if [[ -n "$(ls examples/*.sh)" ]]; then shellcheck examples/*.sh; fi
- name: Upload Coverage
run: |
pip3 install coveralls
coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.os }}-Python-${{ matrix.python-version }}
COVERALLS_PARALLEL: true
coveralls:
name: Finish Coveralls
needs: test
runs-on: 'ubuntu-18.04'
steps:

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shimming-toolbox

[![Build Status](https://github.com/shimming-toolbox/shimming-toolbox/actions?query=workflow%3A%22CI-Tests/badge.svg)](https://github.com/shimming-toolbox/shimming-toolbox/actions?query=workflow%3A%22CI-Tests) [![Build Status](https://travis-ci.com/shimming-toolbox/shimming-toolbox.svg?branch=master)](https://travis-ci.com/shimming-toolbox/shimming-toolbox) [![Documentation Status](https://readthedocs.org/projects/shimming-toolbox/badge/?version=latest)](https://www.shimming-toolbox.org/en/latest/?badge=latest) [![Coverage Status](https://coveralls.io/repos/github/shimming-toolbox/shimming-toolbox/badge.svg?branch=master)](https://coveralls.io/github/shimming-toolbox/shimming-toolbox?branch=master)
[![Build Status](https://github.com/shimming-toolbox/shimming-toolbox/actions?query=workflow%3A%22CI-Tests/badge.svg)](https://github.com/shimming-toolbox/shimming-toolbox/actions?query=workflow%3A%22CI-Tests) [![Documentation Status](https://readthedocs.org/projects/shimming-toolbox/badge/?version=latest)](https://www.shimming-toolbox.org/en/latest/?badge=latest) [![Coverage Status](https://coveralls.io/repos/github/shimming-toolbox/shimming-toolbox/badge.svg?branch=master)](https://coveralls.io/github/shimming-toolbox/shimming-toolbox?branch=master)


Code for performing real-time shimming using external MRI shim coils
Expand Down
29 changes: 0 additions & 29 deletions ci.sh

This file was deleted.

0 comments on commit 007bac1

Please sign in to comment.