Skip to content

Commit 5116305

Browse files
authored
Separate lint into several jobs (#2467)
* Separate lint for flask * Seaparate lint for resource-detector-container * Add linting workflow * Update contributing documentation * Fix lint workflow * Add fix for resource-detector-container * Separate lint for sdk-extension-aws * Separate lint for distro * Separate lint for opentelemetry-instrumentation * Separate lint for aiohttp-client * Separate lint for aiohttp-server * Separate lint for aiopg * Separate lint for aws-lambda * Separate lint for botocore * Separate lint for boto3sqs * Separate lint for django * Separate lint for dbapi * Separate lint for boto * Separate lint for elasticsearch * Separate lint for falcon * Separate lint for fastapi * Separate lint for urllib * Separate lint for urllib3 * Separate lint for requests * Separate lint for starlette * Separate lint for jinja2 * Seaparate lint for logging and richconsole * Separate lint for prometheus-remote-write * Separate lint for mysql * Separate lint for mysqlclient * Separate lint for psycopg2 * Separate lint for psycopg * Separate lint for pymemcache * Separate lint for pymongo * Separate lint for pymysql * Separate lint for pyramid * Separate lint for asgi * Separate lint for asyncpg * Separate lint for sqlite3 * Separate lint for wsgi * Separate lint for grpc * Separate lint for sqlalchemy * Separate lint for redis * Separate lint for remoulade * Separate lint for celery and sklearn * Separate lint for system-metrics * Separate lint for threading * Separate lint for tornado * Separate lint for tortoiseorm * Separate lint for httpx * Separate lint for propagator-aws-xray * Remove lint * Separate lint for propagator-ot-trace * Separate lint for sio-pika * Separate lint for aio-pika * Fix aio and sio pika * Separate lint for kafka-python * Separate lint for confluent-kafka * Separate lint for asyncio * Separate lint for cassandra * Separate lint for processor-baggage * Remove lint test environment * Rename lint workflow file * Fix sio-pika lint testing package path * More fixes * Fix linting for opentelemetry-instrumentation * Add section for linting with 3.8 * Add missing lint install command for elasticsearch * Sorted packages
1 parent de7ce0f commit 5116305

File tree

4 files changed

+543
-84
lines changed

4 files changed

+543
-84
lines changed

.github/workflows/lint.yml

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Lint tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'release/*'
7+
pull_request:
8+
env:
9+
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2
10+
11+
jobs:
12+
lint-3_11:
13+
strategy:
14+
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
15+
matrix:
16+
package:
17+
- "distro"
18+
- "exporter-prometheus-remote-write"
19+
- "exporter-richconsole"
20+
- "instrumentation-aio-pika"
21+
- "instrumentation-aiohttp-client"
22+
- "instrumentation-aiohttp-server"
23+
- "instrumentation-aiopg"
24+
- "instrumentation-asgi"
25+
- "instrumentation-asyncio"
26+
- "instrumentation-asyncpg"
27+
- "instrumentation-aws-lambda"
28+
- "instrumentation-boto"
29+
- "instrumentation-boto3sqs"
30+
- "instrumentation-botocore"
31+
- "instrumentation-cassandra"
32+
- "instrumentation-celery"
33+
- "instrumentation-confluent-kafka"
34+
- "instrumentation-dbapi"
35+
- "instrumentation-django"
36+
- "instrumentation-elasticsearch"
37+
- "instrumentation-falcon"
38+
- "instrumentation-fastapi"
39+
- "instrumentation-flask"
40+
- "instrumentation-grpc"
41+
- "instrumentation-httpx"
42+
- "instrumentation-jinja2"
43+
- "instrumentation-kafka-python"
44+
- "instrumentation-logging"
45+
- "instrumentation-mysql"
46+
- "instrumentation-mysqlclient"
47+
- "instrumentation-psycopg"
48+
- "instrumentation-psycopg2"
49+
- "instrumentation-pymemcache"
50+
- "instrumentation-pymongo"
51+
- "instrumentation-pymysql"
52+
- "instrumentation-pyramid"
53+
- "instrumentation-redis"
54+
- "instrumentation-remoulade"
55+
- "instrumentation-requests"
56+
- "instrumentation-sio-pika"
57+
- "instrumentation-sqlalchemy"
58+
- "instrumentation-sqlite3"
59+
- "instrumentation-starlette"
60+
- "instrumentation-system-metrics"
61+
- "instrumentation-threading"
62+
- "instrumentation-tornado"
63+
- "instrumentation-tortoiseorm"
64+
- "instrumentation-urllib"
65+
- "instrumentation-urllib3"
66+
- "instrumentation-wsgi"
67+
- "opentelemetry-instrumentation"
68+
- "processor-baggage"
69+
- "propagator-aws-xray"
70+
- "propagator-ot-trace"
71+
- "resource-detector-container"
72+
- "sdk-extension-aws"
73+
os: [ubuntu-20.04]
74+
runs-on: ubuntu-20.04
75+
steps:
76+
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
77+
uses: actions/checkout@v4
78+
- name: Set up Python 3.11
79+
uses: actions/setup-python@v5
80+
with:
81+
python-version: 3.11
82+
- name: Install tox
83+
run: pip install tox
84+
- name: Cache tox environment
85+
# Preserves .tox directory between runs for faster installs
86+
uses: actions/cache@v4
87+
with:
88+
path: |
89+
.tox
90+
~/.cache/pip
91+
key: v7-build-tox-cache-${{ matrix.package }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
92+
- name: run tox
93+
run: tox -e lint-${{ matrix.package }}
94+
95+
lint-3_8:
96+
strategy:
97+
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
98+
matrix:
99+
package:
100+
- "instrumentation-sklearn"
101+
os: [ubuntu-20.04]
102+
runs-on: ubuntu-20.04
103+
steps:
104+
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
105+
uses: actions/checkout@v4
106+
- name: Set up Python 3.8
107+
uses: actions/setup-python@v5
108+
with:
109+
python-version: 3.8
110+
- name: Install tox
111+
run: pip install tox
112+
- name: Cache tox environment
113+
# Preserves .tox directory between runs for faster installs
114+
uses: actions/cache@v4
115+
with:
116+
path: |
117+
.tox
118+
~/.cache/pip
119+
key: v7-build-tox-cache-${{ matrix.package }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
120+
- name: run tox
121+
run: tox -e lint-${{ matrix.package }}

.github/workflows/test.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
tox-environment: [ "docker-tests", "spellcheck", "lint", "docs", "generate" ]
16+
tox-environment: [ "docker-tests", "spellcheck", "docs", "generate" ]
1717
name: ${{ matrix.tox-environment }}
1818
runs-on: ubuntu-20.04
1919
steps:
@@ -25,9 +25,6 @@ jobs:
2525
python-version: "3.10"
2626
- name: Install tox
2727
run: pip install tox
28-
- name: Install libsnappy-dev
29-
if: ${{ matrix.tox-environment == 'lint' }}
30-
run: sudo apt-get install -y libsnappy-dev
3128
- name: Cache tox environment
3229
# Preserves .tox directory between runs for faster installs
3330
uses: actions/cache@v4

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ You can run `tox` with the following arguments:
6262
- `tox -e py311-test-instrumentation-aiopg` to e.g. run the aiopg instrumentation unit tests under a specific
6363
Python version
6464
- `tox -e spellcheck` to run a spellcheck on all the code
65-
- `tox -e lint` to run lint checks on all code
65+
- `tox -e lint-some-package` to run lint checks on `some-package`
6666

6767
`black` and `isort` are executed when `tox -e lint` is run. The reported errors can be tedious to fix manually.
6868
An easier way to do so is:
6969

70-
1. Run `.tox/lint/bin/black .`
71-
2. Run `.tox/lint/bin/isort .`
70+
1. Run `.tox/lint-some-package/bin/black .`
71+
2. Run `.tox/lint-some-package/bin/isort .`
7272

7373
See
7474
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)

0 commit comments

Comments
 (0)