-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (111 loc) · 3.25 KB
/
tests.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
134
name: Tests
on:
workflow_dispatch: # allow to run manually
push:
pull_request:
jobs:
lint:
strategy:
fail-fast: false
runs-on: ubuntu-latest
name: Lint
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install \
build-essential \
git \
gcc \
libpq-dev \
make \
postgresql \
libpoppler-cpp-dev \
pkg-config \
python3-dev \
--fix-missing
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install -r requirements.txt -r tests_requirements.txt
env:
UV_SYSTEM_PYTHON: true
- name: Linting
run: flake8 src/ tests/ stubs/
- name: Check security issues
run: bandit --recursive --configfile pyproject.toml src/
- name: Static type checking
run: bash mypy.sh
env:
SKIP_VENV: 1
test:
strategy:
fail-fast: false
matrix:
group: [1] # expand as needed for parallelizing
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Test group ${{ matrix.group }}
steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install \
build-essential \
git \
gcc \
libpq-dev \
make \
postgresql \
libpoppler-cpp-dev \
pkg-config \
python3-dev \
--fix-missing
export LC_ALL="C.UTF-8"
export LANG="C.UTF-8"
- name: Checkout repo
uses: actions/checkout@v4
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: |
echo "BUILDKITE_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" \
>> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "BUILDKITE_BRANCH=$(echo ${GITHUB_HEAD_REF} | tr / -)" \
>> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install pytest-split pytest-cov pytest-codecov
# TEMPORARY: editable build so we don't need a path-fix in codecov
uv pip install -e .[test]
env:
UV_SYSTEM_PYTHON: true
- name: Run tests
run: |
pytest \
--splits "1" \
--group "${{matrix.group}}" \
--cov \
--cov-config=pyproject.toml \
--codecov \
--codecov-branch="$BUILDKITE_BRANCH" \
--codecov-commit="$GITHUB_SHA" \
--codecov-slug=seantis/privatim \
--codecov-token="${{ secrets.CODECOV_TOKEN }}" \
tests