Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit d2b1f8f

Browse files
committed
Add GitHub Actions workflow
1 parent 4c6fc07 commit d2b1f8f

3 files changed

Lines changed: 89 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
name: Build server [${{ matrix.platform }}]
10+
runs-on: ${{ matrix.runs-on }}
11+
strategy:
12+
matrix:
13+
include:
14+
- platform: amd64-linux
15+
runs-on: ubuntu-24.04
16+
- platform: arm64-linux
17+
runs-on: ubuntu-24.04-arm
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
- name: Install Rust
22+
uses: CfirTsabari/actions-rs-toolchain@fcebefd2149855a4b12c9ee62208ed0f622de15b
23+
- name: Build server
24+
run: cargo build --release
25+
- name: Upload artifact
26+
uses: actions/upload-artifact@v6
27+
with:
28+
name: ${{ matrix.platform }}
29+
path: target/release/brioche-cache-server
30+
test:
31+
name: Run tests
32+
runs-on: ubuntu-24.04
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v6
36+
- name: Install Rust
37+
uses: CfirTsabari/actions-rs-toolchain@fcebefd2149855a4b12c9ee62208ed0f622de15b
38+
- name: Install nextest
39+
uses: taiki-e/install-action@nextest
40+
- name: Run tests
41+
run: cargo nextest run --workspace
42+
build-and-push-image:
43+
name: Build and push image
44+
needs: [build, test]
45+
runs-on: ubuntu-24.04
46+
permissions:
47+
contents: read
48+
packages: write
49+
attestations: write
50+
id-token: write
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v6
54+
- name: Download artifacts
55+
uses: actions/download-artifact@v7
56+
with:
57+
path: artifacts
58+
- name: Login to GitHub Container Registry
59+
uses: docker/login-action@v3
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.actor }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
- name: Get Docker metadata
65+
id: meta
66+
uses: docker/metadata-action@v5
67+
with:
68+
images: ghcr.io/${{ github.repository }}
69+
tags: type=sha,format=long
70+
- name: Set up QEMU
71+
uses: docker/setup-qemu-action@v3
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
- name: Build and push Docker image
75+
id: push
76+
uses: docker/build-push-action@v6
77+
with:
78+
context: .
79+
platforms: linux/amd64,linux/arm64
80+
push: true
81+
tags: ${{ steps.meta.outputs.tags }}
82+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
FROM rust:1.93 AS builder
2-
WORKDIR /usr/src/brioche-cache-server
3-
COPY Cargo.lock Cargo.toml .
4-
COPY src src
5-
RUN cargo install --locked --path .
6-
7-
FROM debian:bullseye-slim
1+
FROM ubuntu:24.04
82
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
9-
COPY --from=builder /usr/local/cargo/bin/brioche-cache-server /usr/local/bin/brioche-cache-server
3+
ARG TARGETARCH
4+
ARG TARGETOS
5+
COPY ./artifacts/$TARGETARCH-$TARGETOS /usr/local/bin/brioche-cache-server
6+
RUN chmod +x /usr/local/bin/brioche-cache-server
107
EXPOSE 3000/tcp
118
EXPOSE 3001/tcp
129
CMD ["brioche-cache-server"]

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "1.93"

0 commit comments

Comments
 (0)