133 lines (112 loc) · 3.53 KB
/
ci-unit-linux.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
on:
push:
branches:
- master
- 'dev/**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
name: Linux unit test
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
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 }} -c conda-forge
# 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
# upgrade pip to use the most recent resolver
pip install pip --upgrade
# make the build fail quickly on linting errors
pip install pkgmt
pkgmt lint
# 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_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
# run tests
pip install pytest-timeout
pytest tests --cov=ploomber --timeout=120
# run: pkgmt check
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'pkgmt[check]'
- name: Check project
run: |
pkgmt check
broken-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pkgmt
- name: Check for broken links
run: |
pkgmt check-links --only-404