-
Notifications
You must be signed in to change notification settings - Fork 443
133 lines (129 loc) · 5.04 KB
/
pre_merge.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
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
name: PR Checks
on:
push:
branches:
- develop
- releases/**
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch: # run on request (no need for PR)
# Declare default permissions as read only.
permissions: read-all
concurrency:
group: ${{ github.workflow }}-PreMerge-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
Code-Quality-Checks:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install --require-hashes --no-deps -r requirements/gh-actions.txt
pip-compile --generate-hashes -o /tmp/otx-dev-requirements.txt requirements/dev.txt
pip install --require-hashes --no-deps -r /tmp/otx-dev-requirements.txt
rm /tmp/otx-dev-requirements.txt
- name: Code quality checks
run: tox -vv -e pre-commit-all-py310-pt1
Unit-Test:
needs: Code-Quality-Checks
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.9"
tox-env: "py39"
name: Unit-Test-with-Python${{ matrix.python-version }}
uses: ./.github/workflows/run_tests_in_tox_custom.yml
with:
python-version: ${{ matrix.python-version }}
toxenv-pyver: ${{ matrix.tox-env }}
toxenv-task: all
tests-dir: tests/unit
timeout-minutes: 120
upload-artifact: true
artifact-prefix: "unit-test-results"
Coverage-Test:
needs: Code-Quality-Checks
runs-on: [otx-gpu-a10g-1]
container:
image: 219678651685.dkr.ecr.eu-west-1.amazonaws.com/ote-ci:11.7.1.2-devel-ubuntu20.04
options: "--runtime=nvidia --env-file=/home/runner/.nvidia.env --ipc=host"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install --require-hashes --no-deps -r requirements/gh-actions.txt
pip-compile --generate-hashes -o /tmp/otx-dev-requirements.txt requirements/dev.txt
pip install --require-hashes --no-deps -r /tmp/otx-dev-requirements.txt
rm /tmp/otx-dev-requirements.txt
- name: Run unit test
run: tox -vv -e unittest-all-py310-pt1
- name: Upload coverage artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverage
path: .tox/coverage.xml
- name: Upload coverage reports to Codecov
run: |
# If the workflow is triggered from PR then it gets the commit id from the PR.
# else it uses the commit id of the latest commit. This is because the commit
# of the checked-out branch/commit does not exist in the tree as it is grafted.
# Also note: GitHub does not pass secrets to pipelines triggered from a fork.
# This means that upload will fail for PRs from forks.
if [ -n "${{ github.event.pull_request.head.sha }}" ]
then
COMMIT_ID=${{ github.event.pull_request.head.sha }}
else
COMMIT_ID=${{ github.sha }}
fi
# current version of codecov-action does not support uploading reports through the proxy
# so we use the latest version of codecov uploader binary
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }} --sha $COMMIT_ID -U $HTTP_PROXY -f .tox/coverage.xml -F ${{ matrix.tox-env }}
Integration-Test:
needs: [Unit-Test, Coverage-Test]
strategy:
fail-fast: false
matrix:
include:
- task: "all"
test_dir: "tests/integration/cli/test_cli.py"
- task: "cls"
test_dir: "tests/integration/cli/classification"
- task: "det"
test_dir: "tests/integration/cli/detection"
- task: "iseg"
test_dir: "tests/integration/cli/instance_segmentation"
- task: "seg"
test_dir: "tests/integration/cli/semantic_segmentation"
- task: "act"
test_dir: "tests/integration/cli/action"
- task: "ano"
test_dir: "tests/integration/cli/anomaly"
- task: "visprompt"
test_dir: "tests/integration/cli/visual_prompting"
name: Integration-Test-py310-${{ matrix.task }}
uses: ./.github/workflows/run_tests_in_tox_custom.yml
with:
python-version: "3.10"
toxenv-pyver: "py310"
toxenv-task: ${{ matrix.task }}
tests-dir: ${{ matrix.test_dir }}
timeout-minutes: 120
upload-artifact: true
artifact-prefix: "intg-test-results"