forked from ploomber/ploomber
96 lines (77 loc) · 2.53 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI Linux
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Config
run: |
conda create -q -n conda-env python=${{ matrix.python-version }}
# for the tests that depend on git repos
git config --global user.email "someone@example.com"
git config --global user.name "Someone"
- name: Install dependencies
run: |
eval "$(conda shell.bash hook)"
conda activate conda-env
# make the build fail quickly on flake8 errors
pip install flake8
flake8
# for some reason, conda does not resolve the env correctly and
# installs and old version of pygraphviz (1.3) which breaks in
# Python 3.7
conda install -y "pygraphviz>=1.6" -c conda-forge
# Test vanilla installation, make sure core modules are importable
pip install .
python -c 'import ploomber'
python -c 'import ploomber.tasks'
python -c 'import ploomber.products'
python -c 'import ploomber.clients'
python -c 'import ploomber.io'
# install dev requirements
pip install .[dev]
# install IR kernel
echo "install.packages('IRkernel', repos='http://cran.us.r-project.org'); IRkernel::installspec()" | Rscript -
# install sample package for tests
pip install --editable tests/assets/test_pkg
- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLOOMBER_CLOUD_KEY: ${{ secrets.PLOOMBER_CLOUD_KEY }}
PLOOMBER_STATS_ENABLED: false
run: |
eval "$(conda shell.bash hook)"
conda activate conda-env
# doc tests
export PY_IGNORE_IMPORTMISMATCH=1
pytest src/ploomber --doctest-modules --ignore src/ploomber/resources
unset PY_IGNORE_IMPORTMISMATCH
# unit tests
pytest tests --cov=ploomber
coveralls