-
-
Notifications
You must be signed in to change notification settings - Fork 81
96 lines (79 loc) · 2.78 KB
/
python-package.yml
File metadata and controls
96 lines (79 loc) · 2.78 KB
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
name: main
on: [push, pull_request]
jobs:
tests:
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ (matrix.os == 'windows-latest' && 30) || 15 }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
concurrency:
group: ci-tests-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pysus
auto-update-conda: true
conda-solver: libmamba
- name: Install dependencies
shell: bash -l {0}
run: |
pip install poetry poetry-plugin-export
poetry config virtualenvs.create false
if [ "${{ runner.os }}" = "Linux" ]; then
poetry install --without dev --extras dbc
pip install pre-commit
else
poetry install --without dev
fi
pip install pytest pytest-timeout pytest-retry pytest-asyncio pytest-cov
- name: Linting
if: matrix.os == 'ubuntu-latest'
shell: bash -l {0}
run: pre-commit run --files pysus/**/*
- name: Tests (Linux)
if: matrix.os != 'windows-latest'
shell: bash -l {0}
run: |
poetry run pytest -vv pysus/tests/ --retries 3 --retry-delay 15 --cov=pysus --cov-report=xml:coverage.xml --cov-report=term-missing
- name: Tests (Windows)
if: matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
export DUCKDB_NO_THREADS=1
poetry run pytest -vv pysus/tests/ --retries 3 --retry-delay 15 --timeout=480 -p no:cacheprovider -p no:asyncio
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
docker-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker compose -f docker/docker-compose.yaml build
- name: Start container
run: docker compose -f docker/docker-compose.yaml up -d
- name: Wait for Jupyter
run: |
for i in $(seq 1 10); do
curl -s -o /dev/null http://127.0.0.1:8888 && break
sleep 2
done
- name: Run tests inside container
run: docker compose -f docker/docker-compose.yaml exec -T -w /usr/src jupyter python3 -m pytest -vv pysus/tests/ --retries 3 --retry-delay 15 -x -o cache_dir=/tmp/.pytest_cache
- name: Cleanup
if: always()
run: docker compose -f docker/docker-compose.yaml down -v