Skip to content

Commit

Permalink
Migrate to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoRoth committed Jun 9, 2020
1 parent 08a04ce commit 0d4afef
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Build Docker-Image

on:
push:
branches:
Expand All @@ -10,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
name: Build Docker Image
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Build image
id: build-image
uses: OGGM/docker-build-and-push-action@v1
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Run Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
test-env:
- prepro
- numerics
- models
- benchmark
- utils
- vascaling
- workflow-single
- workflow-multi
- graphics-mpl
container:
- oggm/untested_base:20200323
- oggm/untested_base:py36
include:
- container: python:3.7-slim
test-env: minimal
runs-on: ubuntu-latest
container: ${{ matrix.container }}
continue-on-error: ${{ contains(matrix.container, 'py3') }}
steps:
- name: Install git
if: ${{ contains(matrix.container, 'slim') }}
run: apt-get -y update && apt-get -y install --no-install-recommends git
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: ./ci/run_tests.sh ${{ matrix.test-env }}
env:
DO_COVERALLS: ${{ !contains(matrix.container, 'py3') }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: test-${{ matrix.test-env }}
coveralls:
name: Coveralls Finished
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
42 changes: 42 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -e
set -x

chown -R "$(id -u):$(id -g)" "$HOME"

export OGGM_TEST_ENV="$1"
export OGGM_TEST_MODE=unset
export MPLBACKEND=agg

if [[ $OGGM_TEST_ENV == *-* ]]; then
export OGGM_TEST_MODE="${OGGM_TEST_ENV/*-/}"
export OGGM_TEST_ENV="${OGGM_TEST_ENV/-*/}"
fi

[[ $OGGM_TEST_MODE == single ]] && export OGGM_TEST_MULTIPROC=False
[[ $OGGM_TEST_MODE == multi ]] && export OGGM_TEST_MULTIPROC=True
[[ $OGGM_TEST_MODE == mpl ]] && export OGGM_MPL=--mpl

if [[ $OGGM_TEST_ENV == minimal ]]; then
# Special Mode for minimal tests on minimal Python-Image

export PIP=pip3
$PIP install --upgrade pytest git+https://github.com/OGGM/pytest-mpl.git
fi

[[ -d .git ]] || export SETUPTOOLS_SCM_PRETEND_VERSION="g$GITHUB_SHA"

$PIP install --upgrade git+https://github.com/TimoRoth/coveralls-python.git coverage git+https://github.com/fmaussion/salem.git
$PIP install -e .

coverage erase --rcfile=.coveragerc

coverage run --rcfile=.coveragerc --source=./oggm --parallel-mode --module \
pytest --verbose --mpl-upload $OGGM_MPL --run-slow --run-test-env $OGGM_TEST_ENV oggm

coverage combine --rcfile=.coveragerc
coverage report --skip-covered --rcfile=.coveragerc

if [[ $DO_COVERALLS == true ]]; then
coveralls
fi

0 comments on commit 0d4afef

Please sign in to comment.