Repository navigation
123 lines (108 loc) · 3.79 KB
/
Copy pathci.yml
File metadata and controls
123 lines (108 loc) · 3.79 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
112
113
114
115
116
117
118
119
120
121
122
123
name: CI for Lablink Services
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "packages/**"
- "!packages/**/*.md"
- ".github/workflows/ci.yml"
permissions:
id-token: write
contents: read
jobs:
lint:
name: Lint - ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: lablink-client
python-version: "3.10"
working-directory: packages/client
ruff-command: "uv run ruff check src tests"
- package: lablink-allocator
python-version: "3.10"
working-directory: packages/allocator
ruff-command: "uv run ruff check src tests"
- package: lablink-cli
python-version: "3.11"
working-directory: packages/cli
ruff-command: "uv run ruff check src tests"
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up UV
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: ${{ matrix.working-directory }}
run: uv sync --all-extras
- name: Run ruff linter
working-directory: ${{ matrix.working-directory }}
run: ${{ matrix.ruff-command }}
test:
name: Test - ${{ matrix.package }}
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: lablink
POSTGRES_PASSWORD: lablink
POSTGRES_DB: lablink_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
include:
- package: lablink-client
python-version: "3.10"
working-directory: packages/client
test-command: "uv run pytest tests --cov=src/lablink_client_service --cov-report=term-missing:skip-covered --cov-report=xml --cov-report=html --cov-fail-under=90"
needs-tofu: false
- package: lablink-allocator
python-version: "3.10"
working-directory: packages/allocator
test-command: "uv run pytest tests --maxfail=1 --disable-warnings --cov=. --cov-report=xml --cov-report=term --cov-fail-under=90"
needs-tofu: true
- package: lablink-cli
python-version: "3.11"
working-directory: packages/cli
test-command: "uv run pytest tests --cov=src/lablink_cli --cov-report=term-missing:skip-covered --cov-report=xml --cov-report=html --cov-fail-under=90"
needs-tofu: false
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up UV
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Configure AWS credentials for OpenTofu tests
if: matrix.needs-tofu
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION || 'us-west-2' }}
- name: Setup OpenTofu
if: matrix.needs-tofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.12.5
tofu_wrapper: false
- name: Install dependencies
working-directory: ${{ matrix.working-directory }}
run: |
uv sync --all-extras
- name: Remove backend config for OpenTofu tests
if: matrix.needs-tofu
working-directory: packages/allocator/src/lablink_allocator_service/terraform
run: rm -f backend.tf
- name: Run tests
working-directory: ${{ matrix.working-directory }}
run: ${{ matrix.test-command }}