100 lines (81 loc) · 2.88 KB
/
ci-unit-macos.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
on:
push:
branches:
- master
- 'dev/**'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
name: MacOS unit test
jobs:
macOS:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
# https://www.cybertec-postgresql.com/en/postgresql-github-actions-continuous-integration/
- name: Start PostgreSQL
run: |
brew services start postgresql
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [ $i -gt 0 ]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done
- name: Create PostgreSQL user
run: psql --command="CREATE USER postgres PASSWORD 'postgres'" postgres
- name: Update PostgreSQL permissions
run: psql --command="ALTER DATABASE postgres OWNER TO postgres" postgres
- name: Check PostgreSQL authentication
run: PGPASSWORD=postgres pg_isready --dbname postgres --username postgres
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: conda-env
python-version: ${{ matrix.python-version }}
- name: Set up R
uses: r-lib/actions/setup-r@v2
- 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
conda install -y pygraphviz -c conda-forge
# Test vanilla installation, make sure core modules are importable
# note: I needed to add "--ignore-installed certifi" because the
# installation started failing suddenly
pip install . --ignore-installed certifi
python -c 'import ploomber'
python -c 'import ploomber.tasks'
python -c 'import ploomber.products'
python -c 'import ploomber.clients'
# 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:
PLOOMBER_STATS_ENABLED: false
run: |
eval "$(conda shell.bash hook)"
conda activate conda-env
pip install pytest-timeout
pytest tests --timeout=120