-
Notifications
You must be signed in to change notification settings - Fork 23
93 lines (76 loc) · 2.73 KB
/
pre-merge-tests.yml
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
name: Pre-merge tests
# Controls when the action will run. This action can be triggered manually
# (workflow_dispatch trigger), and it will be run automatically when a PR to main is made.
on:
workflow_dispatch:
pull_request:
branches:
- main
env:
PREMERGE_TEST_REPORT: pre_merge_test_report.html
REPORT_DIRECTORY: reports
PYTHONUTF8: '1'
permissions:
contents: read
checks: read
actions: read
jobs:
pr_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-latest]
# include: # DISABELED UNTIL 2.0 RELEASE - Run test with legacy cassette (Currently - Geti 1.8)
# - os: ubuntu-22.04
# python-version: '3.10'
# env: GETI_PLATFORM_VERSION=LEGACY
fail-fast: true
max-parallel: 4
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ matrix.python-version }}
- name: Install package with dev and notebook requirements
run: |
python -m pip install --upgrade pip
pip install ".[dev,notebooks]"
- name: Create report directory
# Creates the temporary directory that is used to store the test report
run: |
mkdir -p env.REPORT_DIRECTORY
- name: Check formatting with black
run: black . --check
- name: Check imports with isort
run: isort . --check
if: ${{ always() }}
- name: Flake8 linting
run: flake8 .
if: ${{ always() }}
- name: Pydocstyle linting
run: pydocstyle geti_sdk --count
if: ${{ always() }}
- name: Test with pytest
run: |
pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=env.REPORT_DIRECTORY/env.PREMERGE_TEST_REPORT --self-contained-html --cov-report html:env.REPORT_DIRECTORY/coverage
- name: Upload test report for pre-merge tests
# Publish the test report to github
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: ${{ always() }}
with:
name: pre-merge-test-reports
path: ${{ env.REPORT_DIRECTORY }}
- name: Clean up report directories
# Remove temporary report directory
if: ${{ always() }}
run: |
rm -r env.REPORT_DIRECTORY