Repository navigation
111 lines (95 loc) · 3.7 KB
/
Copy pathcode-quality.yml
File metadata and controls
111 lines (95 loc) · 3.7 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
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
name: Code Quality
permissions:
contents: read
on:
pull_request:
# Also run on main so the operational deploy can depend on this via workflow_run.
push:
branches: [main]
# Concurrent runs on main can finish out of commit order, and each successful
# finish deploys its commit, so the older commit would deploy last.
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
tests:
name: Tests (${{ matrix.arch }}, ${{ matrix.suite }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
suite: [noaa, other]
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
- suite: noaa
pytest_args: tests/noaa
- suite: other
pytest_args: --ignore=tests/noaa
# Keep deploy-staging.yaml and these steps in sync
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: "Set up Python"
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v6
with:
python-version-file: ".python-version"
- name: Install dependencies
# Needed to be able to compile dependencies on ARM64
env:
DISABLE_NUMCODECS_SSE2: 1
DISABLE_NUMCODECS_AVX2: 1
CFLAGS: "-Wno-implicit-function-declaration"
run: uv sync --all-extras --dev --locked
- name: Install this project
run: "uv pip install -e ."
- name: Run Ruff
if: matrix.suite == 'other'
run: uv run ruff check --output-format=github
- name: Check code format
if: matrix.suite == 'other'
run: uv run ruff format --check
- name: Run ty
if: matrix.suite == 'other'
run: uv run ty check
- name: Run Pytest
run: uv run pytest -p no:sugar --verbose --durations=50 ${{ matrix.pytest_args }}
quality:
name: Code Quality
needs: tests
if: ${{ always() }}
runs-on: ubuntu-24.04
steps:
- name: Require all test partitions to pass
env:
TEST_RESULT: ${{ needs.tests.result }}
run: |
echo "Test matrix result: $TEST_RESULT"
test "$TEST_RESULT" = success
admission:
name: Kubernetes admission
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v6
with:
python-version-file: ".python-version"
- name: Install dependencies
run: uv sync --all-extras --dev --locked
- name: Install isolated Kubernetes API server
run: |
curl --fail --location --retry 3 --output "$RUNNER_TEMP/envtest.tar.gz" https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-v1.36.0/envtest-v1.36.0-linux-amd64.tar.gz
echo "302d6a4c3b7d79b8a6168cd9fd5f18e718048211d25012d969d320e06b39672d17338bcd008c29adf98b41048a6f7d80c90ab0165b4b861497ef74c7bc6c1531 $RUNNER_TEMP/envtest.tar.gz" | sha512sum --check
tar -xzf "$RUNNER_TEMP/envtest.tar.gz" -C "$RUNNER_TEMP"
- name: Test admission on a real API server
env:
REFORMATTERS_ADMISSION_TEST_ASSETS: ${{ runner.temp }}/controller-tools/envtest
run: uv run pytest -n 0 tests/common/kubernetes_security_integration_test.py