forked from ploomber/ploomber
105 lines (92 loc) · 3.68 KB
/
ci-unit-windows.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
# Run unit tests on any branch/fork pull request
on:
push:
branches:
- master
- 'dev/**'
pull_request:
schedule:
- cron: '0 0 * * *'
name: Windows unit test
jobs:
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
# https://www.cybertec-postgresql.com/en/postgresql-github-actions-continuous-integration/
- name: Start PostgreSQL
run: |
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
- name: Change PostgreSQL password
run: |
& $env:PGBIN\psql --command "ALTER USER postgres PASSWORD 'postgres'"
- name: Check PostgreSQL authentication
run: |
$env:PGPASSWORD = 'postgres'
& $env:PGBIN\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: Install dependencies
shell: bash -l {0}
run: |
eval "$(conda shell.bash hook)"
conda activate conda-env
# make the build fail quickly on flake8 errors
pip install flake8
flake8
# there's a bug in jupyter, we need to install this first
conda install pywin32
# install graphviz (pygraphviz not available in conda for win-64,
# it will be installed from pip)
# conda install -y graphviz -c conda-forge
# note: this installation still gives trouble (error when saving png
# files but it makes pygraphviz importable), we can get rid of this
# once we update the tests to mock the @requires decorator to make
# it think that pygraphviz is installed when it's not. the tests
# currently do not call pygraphviz (it's mocked), but @requires imports
# To support python 3.10, installing only for other versions.
VERSION=$(python -c 'import sys; print(".".join(map(str, sys.version_info[1:2])))')
if [ $VERSION -ne 10 ]; then
echo "installing pygraphviz"
conda install -y -c alubbock pygraphviz
dot -c
else
echo "skipping pygraphviz installation"
fi
# seems like pygraphviz just doesnt work on windows
# https://github.com/pygraphviz/pygraphviz/issues/40
# pip install pygraphviz
# 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'
# install dev requirements
pip install .[dev]
# https://github.com/ipython/ipython/issues/12049
pip install prompt-toolkit==2.0.10
# install R and IR kernel
conda install -y r-base r-irkernel -c conda-forge
echo "IRkernel::installspec()" | Rscript -
# install sample package for tests
pip install --editable tests/assets/test_pkg
- name: Run tests
env:
PLOOMBER_STATS_ENABLED: false
PLOOMBER_CLOUD_KEY: ${{ secrets.PLOOMBER_CLOUD_KEY }}
shell: bash -l {0}
run: |
eval "$(conda shell.bash hook)"
conda activate conda-env
pip install pytest-timeout
pytest tests --ignore=tests/cli/test_cloud_execution.py --ignore=tests/cli/test_cloud.py --ignore=tests/cloud --ignore=tests/telemetry --timeout=120