Add meta-test to ensure all .py
files follow PEP 563
#1987
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: build | |
on: | |
pull_request: | |
branches: [master] | |
env: | |
PYTHON_VERSION: '3.8' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install required dependencies | |
run: | | |
python3 -m pip install --upgrade pip poetry | |
poetry config virtualenvs.create false | |
poetry install -E numpy | |
- name: Linting and static code checks | |
run: | | |
pre-commit run --all-files | |
- name: Verify proto files | |
env: | |
TMPDIR: latest_proto | |
PROTO_URL: https://raw.githubusercontent.com/cognitedata/protobuf-files/master/v1/timeseries | |
run: | | |
mkdir $TMPDIR | |
curl --silent $PROTO_URL/data_points.proto --output $TMPDIR/data_points.proto | |
curl --silent $PROTO_URL/data_point_list_response.proto --output $TMPDIR/data_point_list_response.proto | |
diff $TMPDIR/data_points.proto cognite/client/_proto/data_points.proto | |
diff $TMPDIR/data_point_list_response.proto cognite/client/_proto/data_point_list_response.proto | |
build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install core dependencies | |
run: | | |
python3 -m pip install --upgrade pip poetry | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Build docs | |
run: cd docs && make html SPHINXOPTS="-W --keep-going" | |
test_core: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install core dependencies | |
run: | | |
python3 -m pip install --upgrade pip poetry | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Test core | |
env: | |
CI: 1 | |
run: pytest tests/tests_unit -n8 --dist loadscope --maxfail 10 -m 'not dsl' | |
--test-deps-only-core | |
test_full: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install full dependencies | |
run: | | |
python3 -m pip install --upgrade pip poetry | |
poetry config virtualenvs.create false | |
poetry install -E all | |
- name: Test full | |
env: | |
LOGIN_FLOW: client_credentials | |
COGNITE_CLIENT_SECRET: ${{ secrets.COGNITE_CLIENT_SECRET }} | |
COGNITE_TOKEN_URL: https://login.microsoftonline.com/dff7763f-e2f5-4ffd-9b8a-4ba4bafba5ea/oauth2/v2.0/token | |
COGNITE_TOKEN_SCOPES: https://greenfield.cognitedata.com/.default | |
COGNITE_CLIENT_ID: 14fd282e-f77a-457d-add5-928ec2bcbf04 | |
COGNITE_PROJECT: python-sdk-test | |
COGNITE_BASE_URL: https://greenfield.cognitedata.com | |
COGNITE_CLIENT_NAME: python-sdk-integration-tests | |
CI: 1 | |
run: | | |
pytest tests --durations=10 --cov --cov-report xml:coverage.xml -n8 --dist loadscope --reruns 2 | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install full dependencies | |
run: | | |
python3 -m pip install --upgrade pip poetry | |
- name: Build package | |
run: poetry build |