tenseleyflow/documentlanguagemodel / 9979b02

Browse files

ci: docs + release workflows — gh-pages deploy + trusted-publisher PyPI (sprint 16)

Authored by espadonne
SHA
9979b02923e12083b8f50831d0185642521d41e9
Parents
2cf891f
Tree
ed613f1

2 changed files

StatusFile+-
A .github/workflows/docs.yml 63 0
A .github/workflows/release.yml 142 0
.github/workflows/docs.ymladded
@@ -0,0 +1,63 @@
1
+name: docs
2
+
3
+# Builds the MkDocs Material site and deploys to GitHub Pages on every
4
+# push to `trunk` (the main branch name in this repo) and on every
5
+# tagged release. The release workflow doesn't call this one — it
6
+# waits for this to finish via its own deploy step.
7
+
8
+on:
9
+  push:
10
+    branches: [trunk]
11
+    paths:
12
+      - "docs/**"
13
+      - "mkdocs.yml"
14
+      - ".github/workflows/docs.yml"
15
+  workflow_dispatch: {}
16
+
17
+concurrency:
18
+  group: docs-${{ github.ref }}
19
+  cancel-in-progress: true
20
+
21
+permissions:
22
+  contents: read
23
+  pages: write
24
+  id-token: write
25
+
26
+env:
27
+  UV_VERSION: "0.11.6"
28
+  PYTHON_VERSION: "3.11"
29
+
30
+jobs:
31
+  build:
32
+    name: build
33
+    runs-on: ubuntu-latest
34
+    steps:
35
+      - uses: actions/checkout@v4
36
+
37
+      - name: Install uv
38
+        uses: astral-sh/setup-uv@v4
39
+        with:
40
+          version: ${{ env.UV_VERSION }}
41
+
42
+      - name: Sync (docs group only — no heavy ML deps)
43
+        run: uv sync --group docs
44
+
45
+      - name: Build site
46
+        run: uv run mkdocs build --clean --site-dir site/
47
+
48
+      - name: Upload Pages artifact
49
+        uses: actions/upload-pages-artifact@v3
50
+        with:
51
+          path: site/
52
+
53
+  deploy:
54
+    name: deploy to gh-pages
55
+    needs: build
56
+    runs-on: ubuntu-latest
57
+    environment:
58
+      name: github-pages
59
+      url: ${{ steps.deployment.outputs.page_url }}
60
+    steps:
61
+      - name: Deploy
62
+        id: deployment
63
+        uses: actions/deploy-pages@v4
.github/workflows/release.ymladded
@@ -0,0 +1,142 @@
1
+name: release
2
+
3
+# Tag-driven release: push a `v*` tag, the workflow builds the wheel +
4
+# sdist and publishes to PyPI via trusted-publisher OIDC (configure
5
+# the publisher under the project's PyPI settings before the first
6
+# real run). The docs site is deployed separately via `docs.yml`.
7
+#
8
+# Dry-run to test.pypi.org by pushing a `v*-rc*` tag (e.g. `v1.0.0-rc1`).
9
+# The publish step routes to the test index when the tag ends in `-rc*`.
10
+
11
+on:
12
+  push:
13
+    tags:
14
+      - "v*"
15
+
16
+permissions:
17
+  # Required for trusted-publisher OIDC flow.
18
+  id-token: write
19
+  # Required so the workflow can read the repo on a tag push.
20
+  contents: read
21
+
22
+env:
23
+  UV_VERSION: "0.11.6"
24
+  PYTHON_VERSION: "3.11"
25
+
26
+jobs:
27
+  ci-gate:
28
+    name: full CI must pass
29
+    runs-on: ubuntu-latest
30
+    steps:
31
+      - uses: actions/checkout@v4
32
+
33
+      - name: Install uv
34
+        uses: astral-sh/setup-uv@v4
35
+        with:
36
+          version: ${{ env.UV_VERSION }}
37
+
38
+      - name: Sync (all groups)
39
+        run: uv sync --all-extras --dev
40
+
41
+      - name: Ruff
42
+        run: uv run ruff check .
43
+
44
+      - name: Ruff format
45
+        run: uv run ruff format --check .
46
+
47
+      - name: Mypy
48
+        run: uv run mypy src/dlm
49
+
50
+      - name: Pytest (non-slow)
51
+        run: uv run pytest -m "not slow and not online and not gpu"
52
+
53
+  build:
54
+    name: build wheel + sdist
55
+    needs: ci-gate
56
+    runs-on: ubuntu-latest
57
+    steps:
58
+      - uses: actions/checkout@v4
59
+
60
+      - name: Install uv
61
+        uses: astral-sh/setup-uv@v4
62
+        with:
63
+          version: ${{ env.UV_VERSION }}
64
+
65
+      - name: Build
66
+        run: uv build
67
+
68
+      - name: Upload artifacts
69
+        uses: actions/upload-artifact@v4
70
+        with:
71
+          name: dist
72
+          path: dist/
73
+
74
+  publish-testpypi:
75
+    name: publish to test.pypi.org (RC tags only)
76
+    needs: build
77
+    if: contains(github.ref, '-rc')
78
+    runs-on: ubuntu-latest
79
+    environment:
80
+      name: test-pypi
81
+      url: https://test.pypi.org/project/dlm/
82
+    steps:
83
+      - uses: actions/download-artifact@v4
84
+        with:
85
+          name: dist
86
+          path: dist/
87
+
88
+      - name: Publish
89
+        uses: pypa/gh-action-pypi-publish@release/v1
90
+        with:
91
+          repository-url: https://test.pypi.org/legacy/
92
+
93
+  publish-pypi:
94
+    name: publish to pypi.org (release tags)
95
+    needs: build
96
+    if: ${{ !contains(github.ref, '-rc') }}
97
+    runs-on: ubuntu-latest
98
+    environment:
99
+      name: pypi
100
+      url: https://pypi.org/project/dlm/
101
+    steps:
102
+      - uses: actions/download-artifact@v4
103
+        with:
104
+          name: dist
105
+          path: dist/
106
+
107
+      - name: Publish
108
+        uses: pypa/gh-action-pypi-publish@release/v1
109
+
110
+  deploy-docs:
111
+    name: deploy docs for release
112
+    needs: publish-pypi
113
+    runs-on: ubuntu-latest
114
+    permissions:
115
+      contents: read
116
+      pages: write
117
+      id-token: write
118
+    environment:
119
+      name: github-pages
120
+      url: ${{ steps.deployment.outputs.page_url }}
121
+    steps:
122
+      - uses: actions/checkout@v4
123
+
124
+      - name: Install uv
125
+        uses: astral-sh/setup-uv@v4
126
+        with:
127
+          version: ${{ env.UV_VERSION }}
128
+
129
+      - name: Sync docs group
130
+        run: uv sync --group docs
131
+
132
+      - name: Build site
133
+        run: uv run mkdocs build --clean --site-dir site/
134
+
135
+      - name: Upload Pages artifact
136
+        uses: actions/upload-pages-artifact@v3
137
+        with:
138
+          path: site/
139
+
140
+      - name: Deploy
141
+        id: deployment
142
+        uses: actions/deploy-pages@v4