-
Notifications
You must be signed in to change notification settings - Fork 4
151 lines (148 loc) · 5.37 KB
/
test.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
on:
workflow_dispatch:
pull_request:
branches:
- develop
paths-ignore:
- '**.md'
- 'docs/**'
name: test
jobs:
tests:
if: ${{ github.event.action != 'closed' || github.event.pull_request.merged == true }}
runs-on: ubuntu-20.04
strategy:
matrix:
use-numpy:
- 0
- 1
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy-3.9"
- "pypy-3.10"
proton-version:
- "latest"
name: ${{ matrix.python-version }} PROTON=${{ matrix.proton-version }} NUMPY=${{ matrix.use-numpy }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
env:
if: ${{ matrix.python-version == 3.5 }}
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Install flake8
run: |
pip install --upgrade pip setuptools wheel
pip install flake8 flake8-print
- name: Run flake8
run: flake8
- name: Start Proton server and client containers
run: |
echo "VERSION=${{ matrix.proton-version }}" > tests/.env
echo "ORG=timeplus" >> tests/.env
docker compose -f tests/docker-compose.yml up -d
- name: Setup proton-client proxy for docker
run: |
# Faking proton-client real communication with container via docker exec.
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client timeplusd client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
sudo chmod +x /usr/local/bin/proton-client
# Overriding setup.cfg. Set host=proton-server
sed -i 's/^host=localhost$/host=proton-server/' setup.cfg
# Make host think that proton-server is localhost
echo '127.0.0.1 proton-server' | sudo tee /etc/hosts > /dev/null
- name: Build cython extensions with tracing
run: CYTHON_TRACE=1 python setup.py build_ext --define CYTHON_TRACE
if: ${{ !contains(matrix.python-version, 'pypy') }}
- name: Install requirements
run: |
# Newer coveralls do not work with github actions.
pip install 'coveralls<3.0.0'
pip install cython
python testsrequire.py
python setup.py develop
# Limit each test time execution.
pip install pytest-timeout
env:
USE_NUMPY: ${{ matrix.use-numpy }}
- name: Run tests
run: coverage run -m pytest --timeout=10 -v
timeout-minutes: 5
env:
# Set initial TZ for docker exec -e "`env | grep ^TZ`"
TZ: UTC
- name: Upload coverage
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.python-version }} CH=${{ matrix.proton-version }} NUMPY=${{ matrix.use-numpy }}
coveralls-finished:
name: Indicate completion to coveralls.io
needs: tests
runs-on: ubuntu-latest
steps:
- name: Finished
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
valgrind:
name: Valgrind check
needs: tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
- name: Install valgrind
run: sudo apt-get update && sudo apt-get install -y valgrind
# - name: Login to Docker Hub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Start Proton server and client containers
run: |
echo "VERSION=$VERSION" > tests/.env
echo "ORG=timeplus" >> tests/.env
docker compose -f tests/docker-compose.yml up -d
env:
VERSION: latest
- name: Setup proton-client proxy for docker
run: |
# Faking proton-client real communication with container via docker exec.
echo -e '#!/bin/bash\n\ndocker exec -e "`env | grep ^TZ=`" test-proton-client timeplusd client "$@"' | sudo tee /usr/local/bin/proton-client > /dev/null
sudo chmod +x /usr/local/bin/proton-client
# Overriding setup.cfg. Set host=proton-server
sed -i 's/^host=localhost$/host=proton-server/' setup.cfg
# Make host think that proton-server is localhost
echo '127.0.0.1 proton-server' | sudo tee /etc/hosts > /dev/null
- name: Install requirements
run: |
python testsrequire.py
python setup.py develop
env:
USE_NUMPY: 1
- name: Run tests under valgrind
run: valgrind --error-exitcode=1 --suppressions=valgrind.supp pytest -v
env:
# Set initial TZ for docker exec -e "`env | grep ^TZ`"
TZ: UTC
USE_NUMPY: 1
PYTHONMALLOC: malloc