Skip to content

Commit 50d2c0c

Browse files
authored
Merge pull request #131 from lsst-sqre/tickets/DM-54209
DM-54209: Set up Docverse project
2 parents 2a0cd86 + 06c75c7 commit 50d2c0c

File tree

133 files changed

+2818
-6936
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2818
-6936
lines changed

.claude/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
settings.local.json

.dockerignore

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
# Python artifacts
12
**/*.pyc
23
**/*.pyd
34
**/*.pyo
45
**/__pycache__
5-
/__pycache__
6+
*.egg-info/
67
*.sqlite
8+
9+
# Development and CI directories
10+
.claude/
11+
.github/
12+
.mypy_cache/
13+
.nox/
14+
.pytest_cache/
15+
.ruff_cache/
16+
.venv/
17+
.coverage*
18+
htmlcov/
19+
20+
# Legacy code
21+
keeper/
22+
23+
# Tests
24+
tests/
25+
client/tests/
26+
27+
# Development config files
28+
.pre-commit-config.yaml
29+
.python-version
30+
noxfile.py
31+
ruff-shared.toml
32+
scriv-client.ini
33+
scriv-server.ini
34+
server-changelog.d/
35+
client/changelog.d/
36+
Makefile

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ updates:
55
schedule:
66
interval: "weekly"
77

8-
- package-ecosystem: "docker"
8+
- package-ecosystem: "pip"
99
directory: "/"
1010
schedule:
1111
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 88 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,134 @@
11
name: CI
22

3-
'on':
3+
"on":
4+
merge_group: {}
5+
pull_request: {}
46
push:
57
branches-ignore:
6-
# These should always correspond to pull requests, so ignore them for
7-
# the push trigger and let them be triggered by the pull_request
8-
# trigger, avoiding running the workflow twice. This is a minor
9-
# optimization so there's no need to ensure this is comprehensive.
10-
- 'dependabot/**'
11-
- 'renovate/**'
12-
- 'tickets/**'
13-
- 'u/**'
14-
tags:
15-
- '*'
16-
pull_request: {}
8+
- "dependabot/**"
9+
- "renovate/**"
10+
- "u/**"
11+
release:
12+
types: [published]
1713

1814
jobs:
1915
lint:
2016
runs-on: ubuntu-latest
17+
timeout-minutes: 10
2118

2219
steps:
23-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2421

2522
- name: Set up Python
26-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2724
with:
28-
python-version: "3.10"
25+
python-version-file: ".python-version"
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
2929

30-
- name: Run pre-commit
31-
uses: pre-commit/action@v3.0.0
30+
- name: Run linters
31+
run: uv run --only-group=lint pre-commit run --all-files
3232

3333
test:
3434
runs-on: ubuntu-latest
35-
needs: [lint]
36-
37-
strategy:
38-
matrix:
39-
python:
40-
- "3.10"
41-
db:
42-
- sqlite
43-
- postgres
44-
# - mysql
35+
timeout-minutes: 10
4536

4637
steps:
47-
- uses: actions/checkout@v3
48-
49-
- name: Install build tools
50-
run: sudo apt-get install build-essential
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
5141

5242
- name: Set up Python
53-
uses: actions/setup-python@v4
43+
uses: actions/setup-python@v5
5444
with:
55-
python-version: ${{ matrix.python }}
45+
python-version-file: ".python-version"
5646

57-
- name: Install tox
58-
run: |
59-
pip install 'requests<2.32.0'
60-
pip install tox
61-
pip install --pre tox-docker
47+
- name: Install uv
48+
uses: astral-sh/setup-uv@v5
6249

63-
- name: Cache tox environments
64-
id: cache-tox
65-
uses: actions/cache@v3
66-
with:
67-
path: .tox
68-
# requirements/*.txt and pyproject.toml have versioning info
69-
# that would impact the tox environment.
70-
key: tox-${{ matrix.python }}--${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}
71-
restore-keys: |
72-
tox-${{ matrix.python }}-${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}-
73-
74-
- name: Run tox with external services
75-
if: ${{ matrix.python == '3.10' && matrix.db == 'postgres' }}
76-
env:
77-
LTD_KEEPER_TEST_AWS_ID: ${{ secrets.LTD_KEEPER_TEST_AWS_ID }}
78-
LTD_KEEPER_TEST_AWS_SECRET: ${{ secrets.LTD_KEEPER_TEST_AWS_SECRET }}
79-
LTD_KEEPER_TEST_BUCKET: ${{ secrets.LTD_KEEPER_TEST_BUCKET }}
80-
# run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
81-
run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path
82-
83-
- name: Run tox without external services
84-
if: ${{ !(matrix.python != '3.10' && matrix.db != 'postgres') }}
85-
# run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path
86-
run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path
87-
88-
docs:
50+
- name: Run typing
51+
run: uv run --only-group=nox nox -s typing
52+
53+
- name: Run tests
54+
run: uv run --only-group=nox nox -s test
55+
56+
client-test:
8957
runs-on: ubuntu-latest
90-
needs: [lint]
58+
timeout-minutes: 10
9159

9260
steps:
93-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
9462
with:
9563
fetch-depth: 0
9664

9765
- name: Set up Python
98-
uses: actions/setup-python@v4
66+
uses: actions/setup-python@v5
9967
with:
100-
python-version: "3.10"
68+
python-version: |
69+
3.12
70+
3.13
10171
102-
- name: Install Python dependencies
103-
run: pip install tox ltd-conveyor
72+
- name: Install uv
73+
uses: astral-sh/setup-uv@v5
10474

105-
- name: Cache tox environment for docs
106-
id: cache-tox
107-
uses: actions/cache@v3
108-
with:
109-
path: .tox
110-
# requirements/*.txt, pyproject.toml, and .pre-commit-config.yaml
111-
# have versioning info that would impact the tox environment.
112-
key: tox-docs-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }}
113-
114-
- name: Run tox
115-
run: tox -e docs
116-
117-
- name: Upload documentation
118-
if: ${{ github.event_name == 'push' }}
119-
env:
120-
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }}
121-
LTD_USERNAME: ${{ secrets.LTD_USERNAME }}
122-
run: |
123-
ltd upload --gh --dir docs/_build/html --product ltd-keeper
75+
- name: Run client tests
76+
run: >-
77+
uv run --only-group=nox nox -s
78+
client_test
79+
client_test_compat
80+
client_test_oldest
12481
12582
build:
83+
needs: [test, client-test]
84+
uses: lsst-sqre/multiplatform-build-and-push/.github/workflows/build.yaml@v3
85+
with:
86+
images: ghcr.io/${{ github.repository }}
87+
# Build on server releases and ticket branch PRs (exclude client releases)
88+
if: >
89+
(github.event_name == 'release'
90+
&& !startsWith(github.event.release.tag_name, 'client/'))
91+
|| (github.event_name != 'merge_group'
92+
&& (startsWith(github.head_ref, 'tickets/')
93+
|| startsWith(github.head_ref, 't/')))
94+
95+
client-test-packaging:
96+
name: Test client packaging
12697
runs-on: ubuntu-latest
127-
needs: [test]
128-
129-
# Only do Docker builds of ticket branches and tagged releases, as well
130-
# as J.Sick Codes branches.
131-
# if: >
132-
# (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/')) || startsWith(github.ref, 'refs/heads/u/jsickcodes/')
98+
timeout-minutes: 5
99+
needs: [lint, test, client-test]
133100

134101
steps:
135-
- uses: actions/checkout@v3
102+
- uses: actions/checkout@v4
136103
with:
137-
fetch-depth: 0
104+
fetch-depth: 0 # full history for setuptools_scm
138105

139-
- name: Define the Docker tag
140-
id: vars
141-
run: echo ::set-output name=tag::$(bin/docker-tag.sh)
142-
143-
- name: Print the tag
144-
id: print
145-
run: echo ${{ steps.vars.outputs.tag }}
106+
- name: Build and publish
107+
uses: lsst-sqre/build-and-publish-to-pypi@v3
108+
with:
109+
working-directory: client
110+
upload: false
146111

147-
- name: Set up Docker Buildx
148-
uses: docker/setup-buildx-action@v2
112+
client-pypi:
113+
name: Upload client to PyPI
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 10
116+
needs: [lint, test, client-test, client-test-packaging]
117+
environment:
118+
name: pypi
119+
url: https://pypi.org/p/docverse-client
120+
permissions:
121+
id-token: write
122+
if: >
123+
github.event_name == 'release'
124+
&& startsWith(github.event.release.tag_name, 'client/')
149125
150-
- name: Log in to GitHub Container Registry
151-
uses: docker/login-action@v2
126+
steps:
127+
- uses: actions/checkout@v4
152128
with:
153-
registry: ghcr.io
154-
username: ${{ github.repository_owner }}
155-
password: ${{ secrets.GITHUB_TOKEN }}
129+
fetch-depth: 0 # full history for setuptools_scm
156130

157-
- name: Build and push
158-
uses: docker/build-push-action@v3
131+
- name: Build and publish
132+
uses: lsst-sqre/build-and-publish-to-pypi@v3
159133
with:
160-
context: .
161-
push: true
162-
tags: |
163-
ghcr.io/lsst-sqre/ltd-keeper:${{ steps.vars.outputs.tag }}
164-
cache-from: type=gha
165-
cache-to: type=gha,mode=max
134+
working-directory: client

0 commit comments

Comments
 (0)