Skip to content

Commit 9142865

Browse files
GitHub Workflows: Adapted from pdfassistant-chatbot
- ...by Codex
1 parent 552deeb commit 9142865

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
- feature-*
10+
11+
jobs:
12+
pre-commit:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
contents: read
17+
packages: write
18+
pull-requests: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v1
27+
- name: Restore uv cache
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cache/uv
32+
.venv
33+
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
34+
- name: Synchronize project dependencies
35+
run: uv sync --group dev
36+
- name: Run pre-commit checks
37+
run: uv run pre-commit run --all-files --hook-stage manual
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Test and Publish
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
- feature-*
10+
release:
11+
types:
12+
- published
13+
14+
jobs:
15+
tests:
16+
name: Tests (Python ${{ matrix.python-version }})
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
22+
permissions:
23+
id-token: write
24+
contents: read
25+
packages: write
26+
pull-requests: write
27+
env:
28+
UV_PROJECT_ENVIRONMENT: .venv-${{ matrix.python-version }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v1
37+
- name: Restore uv cache
38+
uses: actions/cache@v4
39+
with:
40+
path: |
41+
~/.cache/uv
42+
${{ env.UV_PROJECT_ENVIRONMENT }}
43+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
44+
- name: Synchronize project dependencies
45+
run: uv sync --group dev --python ${{ matrix.python-version }}
46+
- name: Run tests
47+
run: uv run pytest
48+
49+
publish:
50+
name: Publish to CodeArtifact
51+
needs: tests
52+
if: github.event_name == 'release'
53+
runs-on: ubuntu-latest
54+
permissions:
55+
id-token: write
56+
contents: read
57+
packages: write
58+
env:
59+
UV_PROJECT_ENVIRONMENT: .venv-release
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Assume AWS role for repository CI
63+
uses: aws-actions/configure-aws-credentials@v4
64+
with:
65+
role-to-assume: arn:aws:iam::304774597385:role/cit-oidc-role-${{ github.event.repository.name }}-ci
66+
aws-region: us-east-2
67+
- name: Set up Python
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: "3.11"
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v1
73+
- name: Restore uv cache
74+
uses: actions/cache@v4
75+
with:
76+
path: |
77+
~/.cache/uv
78+
${{ env.UV_PROJECT_ENVIRONMENT }}
79+
key: ${{ runner.os }}-uv-release-${{ hashFiles('pyproject.toml') }}
80+
- name: Synchronize project dependencies
81+
run: uv sync --group dev
82+
- name: Build distribution artifacts
83+
run: uv build
84+
- name: Log in to CodeArtifact for publishing
85+
run: >-
86+
aws codeartifact login
87+
--tool twine
88+
--domain datalogics
89+
--domain-owner 304774597385
90+
--repository cit-pypi
91+
--region us-east-2
92+
- name: Publish package to CodeArtifact
93+
run: uv tool run --from twine twine upload --non-interactive --skip-existing dist/*

0 commit comments

Comments
 (0)