Skip to content

Commit 650d1ce

Browse files
committed
wip
1 parent a532e40 commit 650d1ce

File tree

4 files changed

+180
-0
lines changed

4 files changed

+180
-0
lines changed

.github/workflows/ci-image.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'deploy/docker/Dockerfile.ci'
8+
- 'mise.toml'
9+
- 'build/**'
10+
- '.github/workflows/ci-image.yml'
11+
pull_request:
12+
branches: [main]
13+
paths:
14+
- 'deploy/docker/Dockerfile.ci'
15+
- 'mise.toml'
16+
- 'build/**'
17+
- '.github/workflows/ci-image.yml'
18+
19+
env:
20+
REGISTRY: ghcr.io
21+
CI_IMAGE: ghcr.io/${{ github.repository }}/ci
22+
23+
permissions:
24+
contents: read
25+
packages: write
26+
27+
jobs:
28+
build-ci-image:
29+
name: Build CI Image
30+
runs-on: build-amd64
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Log in to GitHub Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Install mise
42+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8
43+
with:
44+
install: false
45+
46+
- name: Set up Docker Buildx
47+
run: mise run docker:buildx:setup
48+
env:
49+
MISE_AUTO_INSTALL: "0"
50+
MISE_TASK_RUN_AUTO_INSTALL: "0"
51+
MISE_NOT_FOUND_AUTO_INSTALL: "0"
52+
53+
- name: Build CI image
54+
if: github.ref != 'refs/heads/main'
55+
run: |
56+
docker buildx build \
57+
--platform linux/amd64,linux/arm64 \
58+
--cache-from type=registry,ref=${{ env.CI_IMAGE }}:buildcache \
59+
-t ${{ env.CI_IMAGE }}:${{ github.sha }} \
60+
-f deploy/docker/Dockerfile.ci \
61+
.
62+
63+
- name: Build and push CI image
64+
if: github.ref == 'refs/heads/main'
65+
run: |
66+
docker buildx build \
67+
--platform linux/amd64,linux/arm64 \
68+
--cache-from type=registry,ref=${{ env.CI_IMAGE }}:buildcache \
69+
--cache-to type=registry,ref=${{ env.CI_IMAGE }}:buildcache,mode=max \
70+
--push \
71+
-t ${{ env.CI_IMAGE }}:${{ github.sha }} \
72+
-t ${{ env.CI_IMAGE }}:latest \
73+
-f deploy/docker/Dockerfile.ci \
74+
.

.github/workflows/python.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Python
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
9+
permissions:
10+
contents: read
11+
packages: read
12+
13+
jobs:
14+
python:
15+
name: Python
16+
runs-on: build-amd64
17+
container:
18+
image: ${{ env.REGISTRY }}/${{ github.repository }}/ci:latest
19+
credentials:
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Install dependencies
26+
run: uv sync --frozen
27+
28+
- name: Lint
29+
run: mise run python:lint
30+
31+
- name: Test
32+
run: mise run test:python

.github/workflows/rust.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Rust
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
CARGO_INCREMENTAL: "0"
9+
REGISTRY: ghcr.io
10+
11+
permissions:
12+
contents: read
13+
packages: read
14+
15+
jobs:
16+
rust:
17+
name: Rust
18+
runs-on: build-amd64
19+
container:
20+
image: ${{ env.REGISTRY }}/${{ github.repository }}/ci:latest
21+
credentials:
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Check formatting
28+
run: mise run fmt:check
29+
30+
- name: Clippy
31+
run: mise run clippy
32+
33+
- name: Test
34+
run: mise run test:rust

build/docker.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Docker image build tasks
22

3+
["docker:buildx:setup"]
4+
description = "Create a multi-arch buildx builder with remote BuildKit nodes"
5+
usage = """
6+
flag "--amd64 <endpoint>" default="tcp://buildkit-amd64.buildkit:1234" help="BuildKit endpoint for linux/amd64"
7+
flag "--arm64 <endpoint>" default="tcp://buildkit-arm64.buildkit:1234" help="BuildKit endpoint for linux/arm64"
8+
flag "--name <name>" default="navigator" help="Builder instance name"
9+
"""
10+
run = """
11+
#!/usr/bin/env bash
12+
set -euo pipefail
13+
14+
BUILDER="${usage_name}"
15+
AMD64="${usage_amd64}"
16+
ARM64="${usage_arm64}"
17+
18+
# Remove existing builder if present so we get a clean config
19+
if docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then
20+
echo "Removing existing builder: ${BUILDER}"
21+
docker buildx rm "${BUILDER}"
22+
fi
23+
24+
echo "Creating builder: ${BUILDER}"
25+
docker buildx create \
26+
--name "${BUILDER}" \
27+
--driver remote \
28+
--platform linux/amd64 \
29+
"${AMD64}"
30+
31+
docker buildx create \
32+
--name "${BUILDER}" \
33+
--append \
34+
--driver remote \
35+
--platform linux/arm64 \
36+
"${ARM64}"
37+
38+
docker buildx use "${BUILDER}"
39+
echo "Builder '${BUILDER}' is now active:"
40+
docker buildx inspect "${BUILDER}"
41+
"""
42+
343
["docker:build"]
444
description = "Build all Docker images"
545
depends = [

0 commit comments

Comments
 (0)