Skip to content

Commit

Permalink
Add GitHub Actions CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
douglatornell committed Apr 14, 2020
1 parent 55df584 commit 95e8bde
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/pytest-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
test-coverage:
name: pytest & coverage report
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7']

steps:
- uses: actions/checkout@v2

- uses: goanpeca/setup-miniconda@v1
with:
auto-update-conda: true
auto-activate-base: false
environment-file: envs/environment-test.yaml
python-version: ${{ matrix.python-version }}
activate-environment: salishsea-site-test

- name: Install package
shell: bash -l {0}
run: |
python3 -m pip install --editable $GITHUB_WORKSPACE
- name: pytest package with coverage
shell: bash -l {0}
run: |
pytest --cov=$GITHUB_WORKSPACE --cov-report=xml
- uses: pioug/le-slack-message@v1.0.0
with:
ACTION_NAME: ${{ github.repository }} pytest suite for Python ${{ matrix.python-version }}
JOB: ${{ toJson(job) }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
if: always()
30 changes: 30 additions & 0 deletions envs/environment-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# conda environment description file for salishsea-site package testing environment
#
# Creates a conda environment in which the salishsea-site package unit tests and
# coverage analysis can be run.
# Primarily intended for creation of a conda env for use in a GitHub Actions workflow.

name: salishsea-site-test

channels:
- conda-forge
- defaults

dependencies:
- pip
- pyyaml
- requests

# For unit tests and coverage monitoring
- pytest
- pytest-cov

- pip:
- arrow
- attrs
- pyramid
- pyramid_debugtoolbar
- pyramid_mako
- sentry-sdk
- supervisor
- waitress

0 comments on commit 95e8bde

Please sign in to comment.