Skip to content

Commit

Permalink
Add GitHub actions workflow (#14)
Browse files Browse the repository at this point in the history
* Add GitHub Actions as CI

Add GitHub Actions workflow that tests the Jupyter notebooks in Python
3.6.8 and Python 3.7.3 Debian Docker images by running an install and
test suite defined in entrypoint.sh

c.f.
https://developer.github.com/actions/managing-workflows/workflow-configuration-options/

* Split workflows for seperate exit statuses

Seperate workflows are entirely different and so will have seperate exit
statuses. If they were not split and one failed then the whole workflow
woull immediatley fail and stop.

c.f. https://jasonet.co/posts/use-github-actions-for-ci/

* use --no-cache-dir as inside Docker images

As this is a CI job with no method to cache anything then there is no
reason to use a cache directory for pip

* Add monthly scheduled job
  • Loading branch information
matthewfeickert authored May 11, 2019
1 parent d8b05cb commit 146c42d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/actions/tests/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

function print_and_run () {
printf "\n# %s\n" "${1}"
eval $(echo "$1")
}

print_and_run "which python"
print_and_run "which pip"
print_and_run "pip install --upgrade --no-cache-dir -q pip setuptools wheel"
print_and_run "pip list"

# Already there, but to make it clear to reader
print_and_run "cd ${GITHUB_WORKSPACE}"

print_and_run "python --version"
print_and_run "pip --version"
print_and_run "pip install --upgrade --no-cache-dir -q -r binder/requirements.txt"
print_and_run "pip list"

print_and_run "pytest"
24 changes: 24 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
workflow "Test Python 3.6.8" {
on = "push"
resolves = ["Python 3.6.8 Debian"]
}

action "Python 3.6.8 Debian" {
uses = "docker://python:3.6.8"
runs = "./.github/actions/tests/entrypoint.sh"
}

workflow "Test Python 3.7.3" {
on = "push"
resolves = ["Python 3.7.3 Debian"]
}

action "Python 3.7.3 Debian" {
uses = "docker://python:3.7.3"
runs = "./.github/actions/tests/entrypoint.sh"
}

workflow "Monthly Test Python 3.7.3" {
on = "schedule(0 0 1 * *)"
resolves = ["Python 3.7.3 Debian"]
}

0 comments on commit 146c42d

Please sign in to comment.