Skip to content

support json type

support json type #52

Workflow file for this run

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/github-action@v2.3.0
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