Skip to content

Commit 0041bd7

Browse files
Setup CI (#1)
* Setup CI * Fix typechecking
1 parent 59a9573 commit 0041bd7

File tree

7 files changed

+178
-0
lines changed

7 files changed

+178
-0
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Go modules
4+
- package-ecosystem: "uv"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10
9+
10+
# Enable version updates for GitHub Actions
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
open-pull-requests-limit: 10

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Linting
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
18+
with:
19+
enable-cache: true
20+
python-version: '3.13'
21+
22+
- name: Run Linting
23+
run: make lint
24+
25+
- name: Run Typechecking
26+
run: make typecheck

.github/workflows/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# These workflows run on every push to the main branch
2+
name: Main Branch Checks
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [ main ]
10+
11+
jobs:
12+
linting:
13+
name: Linting
14+
uses: ./.github/workflows/lint.yml
15+
tests:
16+
name: Tests
17+
uses: ./.github/workflows/test.yml

.github/workflows/pr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# These set of workflows run on every pull request
2+
name: PR Checks
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
10+
jobs:
11+
linting:
12+
name: Linting
13+
uses: ./.github/workflows/lint.yml
14+
tests:
15+
name: Tests
16+
uses: ./.github/workflows/test.yml

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Release Container
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18+
19+
- name: Linting
20+
uses: ./.github/workflows/lint.yml
21+
22+
- name: Tests
23+
uses: ./.github/workflows/test.yml
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract tag version
36+
id: tag
37+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
38+
39+
- name: Set repository owner lowercase
40+
id: repo_owner
41+
run: echo "OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
42+
43+
- name: Extract metadata
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/plotting-mcp
48+
tags: |
49+
type=ref,event=tag
50+
type=raw,value=latest,enable={{is_default_branch}}
51+
type=raw,value=${{ steps.tag.outputs.VERSION }}
52+
53+
- name: Build and push container
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
platforms: linux/amd64,linux/arm64
58+
push: true
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
cache-from: type=gha
62+
cache-to: type=gha,mode=max
63+
64+
- name: Install Cosign
65+
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3.9.1
66+
67+
- name: Sign container image
68+
env:
69+
REGISTRY: ghcr.io/${{ steps.repo_owner.outputs.OWNER }}/plotting-mcp
70+
run: |
71+
TAG=$(echo "${{ steps.tag.outputs.VERSION }}" | sed 's/+/_/g')
72+
# Sign the tagged image
73+
cosign sign -y $REGISTRY:$TAG
74+
75+
# Sign the latest tag if building from a tag
76+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
77+
cosign sign -y $REGISTRY:latest
78+
fi

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tests
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
18+
with:
19+
enable-cache: true
20+
python-version: '3.13'
21+
22+
- name: Run Pytest
23+
run: make test

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ lint.select = [
5656
]
5757
lint.ignore = []
5858

59+
[tool.ty.src]
60+
exclude = ["tests"]
61+
5962
[tool.pytest.ini_options]
6063
minversion = "8.0"
6164
addopts = [

0 commit comments

Comments
 (0)