Repository navigation
75 lines (69 loc) · 2.18 KB
/
Copy pathbuild-python.yml
File metadata and controls
75 lines (69 loc) · 2.18 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
name: Python
on:
workflow_call:
workflow_dispatch:
pull_request:
paths:
- "python/**"
- "proto/**"
- ".github/workflows/*python*"
- "devops/**"
push:
branches:
- main
paths:
- "python/**"
- "proto/**"
- ".github/workflows/*python*"
- "devops/**"
jobs:
build-and-test-python:
name: Test Python code
runs-on: ${{ matrix.os-artifact[0] }}
strategy:
fail-fast: false
matrix:
os-artifact: [ [ubuntu-latest, linux], [windows-latest, windows], [macos-latest, macos] ]
python-version: [3.7, 3.8, 3.9, '3.10' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: "build-libs.yml"
path: ./libs/${{ matrix.os-artifact[1] }}
github_token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.os-artifact[1] }}
- name: Install Python dependencies
run: pip install --upgrade --upgrade-strategy eager -r requirements.txt
shell: pwsh
working-directory: python
- name: Run linters
uses: wearerequired/lint-action@v2.0.1
with:
black_dir: python/
flake8_dir: python/
black: true
flake8: true
- name: Build, Test, Pack
run: |
python -m pip install -r requirements.txt
python -m pip install pytest pytest-cov
python ../devops/build_sdks.py --language=python
python -m pytest --cache-clear ./tests --cov=./ --cov-report=xml
shell: pwsh
working-directory: python
env:
API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}
OKAPI_LIBRARY_PATH: "${{ github.workspace }}/libs/${{ matrix.os-artifact[1] }}"
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
directory: python
token: ${{ secrets.CODECOV_TOKEN }}