Skip to content

ci: run tests for legacy versions #787

ci: run tests for legacy versions

ci: run tests for legacy versions #787

Workflow file for this run

name: test
permissions:
contents: read
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
lint:
name: Lint datadogpy files on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# In the future, we need to add support for Python 2.7 and Python 3.14+
# but for now, those are failing.
python-version: ['3.8']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install tox
# - name: Run black
# run: pre-commit run --all-files --hook-stage=manual black
- name: Run mypy
run: tox -e mypy
- name: Run flake8
run: tox -e flake8
run:
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy2.7', 'pypy3.8']
# os: [ubuntu-latest, windows-latest, macos-latest]
# python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', 'pypy-2.7', 'pypy-3.8']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Set constraints for python2.7
# Latest PyYaml supported version for python 2.7 is 5.4.1 which requires
# cython<3 to build. See: https://github.com/yaml/pyyaml/issues/724
if: ${{ matrix.python-version == 'pypy2.7' }}
run: |
echo "cython<3" > /tmp/constraints.txt
echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV
- name: Set TOXENV
run: |
version="${{ matrix.python-version }}"
if [[ "$version" == pypy* ]]; then
echo "TOXENV=$version" >> $GITHUB_ENV
else
echo "TOXENV=py${version//./}" >> $GITHUB_ENV
fi
- name: Install tox
run: pip install tox
- name: Run unit tests
run: tox
- name: Run integration tests on cassettes
run: tox -e integration -- --vcr-record=none
- name: Run admin integration tests on cassettes
run: tox -e integration-admin -- --vcr-record=none
run-legacy:
# actions/setup-python dropped support for Python 2.7 and 3.4, so we use
# official Python Docker images instead to test those EOL-but-supported versions.
name: Python ${{ matrix.python-version }} (legacy) on Linux
runs-on: ubuntu-latest
container:
image: python:${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
python-version: ['2.7', '3.4']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set constraints for python2.7
# Latest PyYaml supported version for python 2.7 is 5.4.1 which requires
# cython<3 to build. See: https://github.com/yaml/pyyaml/issues/724
if: ${{ matrix.python-version == '2.7' }}
run: |
echo "cython<3" > /tmp/constraints.txt
echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV
- name: Set TOXENV
run: |
version="${{ matrix.python-version }}"
echo "TOXENV=py${version//./}" >> $GITHUB_ENV
- name: Install tox
# tox 4+ requires Python 3.7+; virtualenv 20.22+ dropped Python 2.7 support.
run: pip install 'tox<4' 'virtualenv<20.22'
- name: Run unit tests
run: tox
- name: Run integration tests on cassettes
run: tox -e integration -- --vcr-record=none
- name: Run admin integration tests on cassettes
run: tox -e integration-admin -- --vcr-record=none