Repository navigation
82 lines (73 loc) · 2.63 KB
/
Copy pathpython_unit_tests.yml
File metadata and controls
82 lines (73 loc) · 2.63 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
76
77
78
79
80
81
82
# Copyright 2026 OpenC3, Inc.
# All Rights Reserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE.md for more details.
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.
name: Python Unit Tests
# Only run on a push to main to avoid running for all the dependabot PRs
on:
push:
branches:
- main
pull_request:
branches:
- "**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
OPENC3_CLOUD: local
OPENC3_REDIS_HOSTNAME: localhost
permissions:
contents: read
jobs:
unit-test:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv and Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-uv-python
with:
python-version: ${{ matrix.python-version }}
cache-suffix: ${{ matrix.python-version }}
# --no-sync runs against the venv the setup action synced, so --no-build
# costs nothing here and keeps a third-party build backend from executing
# if a future dependency arrives without a wheel.
- name: Run unit tests
run: |
uv run --no-sync --no-build coverage run -m pytest ./test/
uv run --no-sync --no-build coverage xml -i
working-directory: openc3/python
- name: Prune uv cache
run: uv cache prune --ci
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
working-directory: openc3/python
flags: python # See codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
# - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v5
# with:
# projectBaseDir: openc3/python
# args: >
# -Dsonar.organization=openc3
# -Dsonar.projectKey=OpenC3_cosmos
# -Dsonar.python.coverage.reportPaths=coverage.xml
# -Dsonar.sources=openc3/
# -Dsonar.tests=test/
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}