-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (127 loc) · 4.13 KB
/
Copy pathci-cd-ds-platform-utils.yaml
File metadata and controls
147 lines (127 loc) · 4.13 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Publish DS Platform Utils
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "README.md"
- "docs/**"
pull_request:
types: [opened, synchronize]
paths-ignore:
- "README.md"
- "docs/**"
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for version tagging
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ github.workspace }}/uv.lock"
- name: Check version
# https://github.com/gnprice/toml-cli
run: |
VERSION=$(uvx --from=toml-cli toml get --toml-path pyproject.toml project.version)
git tag "v$VERSION"
code-quality-checks:
name: Lint, Format, and Static Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ github.workspace }}/uv.lock"
- name: Run pre-commit hooks
run: SKIP=no-commit-to-branch uv run poe lint # using poethepoet needs to be setup before using poe lint
build-wheel:
name: Build Wheel
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ github.workspace }}/uv.lock"
- name: Build Wheel
run: uv build --wheel
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: wheel-dist
path: ./dist/
execute-tests:
needs:
- build-wheel
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ github.workspace }}/uv.lock"
- name: Download Wheel
uses: actions/download-artifact@v4
with:
name: wheel-dist
path: ./dist/
- name: Configure Outerbounds Auth
run: |-
uvx outerbounds service-principal-configure \
--name ds-platform-utils \
--deployment-domain pattern.obp.outerbounds.com \
--perimeter default \
--github-actions
# Temporarily disabling pytest-coverage in CI to avoid --
# coverage.exceptions.DataError: Can't combine branch coverage data with statement data
- name: Install Wheel & Run Tests against Wheel
run: |
uv venv
source .venv/bin/activate
uv pip install ./dist/*whl
uv pip install --group dev
COVERAGE_DIR="$(python -c 'import ds_platform_utils; print(ds_platform_utils.__path__[0])')"
poe clean
poe test --cov="$COVERAGE_DIR" --no-cov -n auto
tag-version:
needs: [check-version, code-quality-checks, build-wheel, execute-tests]
# if - this is a merge to main or push directly to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Tag Version
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "${{ github.workspace }}/uv.lock"
- name: Configure Git user
run: |
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
- name: Push Version Tag
# https://github.com/gnprice/toml-cli
run: |
VERSION=$(uvx --from=toml-cli toml get --toml-path pyproject.toml project.version)
git tag "v${VERSION}" -m "Release version v$VERSION"
git push origin "v$VERSION"