-
Notifications
You must be signed in to change notification settings - Fork 320
156 lines (131 loc) · 5.09 KB
/
test.yml
File metadata and controls
156 lines (131 loc) · 5.09 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
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
152
153
154
155
156
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:
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']
# Python 2.7 and 3.4 are tested separately in the run-legacy job below.
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:
# All actions/checkout versions now use Node.js >= 20 (glibc >= 2.25).
# python:3.4 is Debian Stretch (glibc 2.24) so Node.js can't run there.
# Use a plain git clone instead — no Node.js needed.
- name: Checkout
run: |
git init .
git remote add origin https://github.com/${{ github.repository }}
git fetch --depth 1 origin ${{ github.sha }}
git checkout FETCH_HEAD
- 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 constraints for python3.4
# PyYAML 5.3+ dropped Python 3.4 support; vcrpy pulls it in.
if: ${{ matrix.python-version == '3.4' }}
run: |
echo "PyYAML<5.3" > /tmp/constraints.txt
echo "PIP_CONSTRAINT=/tmp/constraints.txt" >> $GITHUB_ENV
- name: Set TOXENV
# Use tr instead of ${//} because the container runs sh, not bash.
run: |
version="${{ matrix.python-version }}"
echo "TOXENV=py$(echo "$version" | tr -d '.')" >> $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
# Disable origin detection: the job runs inside a Docker container, so
# the client would detect the container ID and append |c:<id> to every
# metric, which the tests don't expect.
env:
DD_ORIGIN_DETECTION_ENABLED: "false"
run: tox
- name: Run integration tests on cassettes
env:
DD_ORIGIN_DETECTION_ENABLED: "false"
run: tox -e integration -- --vcr-record=none
- name: Run admin integration tests on cassettes
env:
DD_ORIGIN_DETECTION_ENABLED: "false"
run: tox -e integration-admin -- --vcr-record=none