Skip to content

Commit 35a1e64

Browse files
committed
initial commit
0 parents  commit 35a1e64

Some content is hidden

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

51 files changed

+8557
-0
lines changed

.cargo/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Cross-compilation configuration
2+
3+
[target.x86_64-apple-darwin]
4+
5+
[target.x86_64-pc-windows-gnu]
6+
linker = "x86_64-w64-mingw32-gcc"
7+
runner = "wine64"
8+
9+
# cargo-zigbuild handles this target

.envrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# shellcheck shell=bash
2+
if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then
3+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM="
4+
fi
5+
use flake .# -j4 --impure

.github/workflows/build.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: build
2+
on:
3+
workflow_call:
4+
inputs:
5+
push-image:
6+
required: false
7+
type: boolean
8+
default: false
9+
create-release:
10+
required: false
11+
type: boolean
12+
default: false
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}-server
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
packages: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: nixbuild/nix-quick-install-action@v34
25+
with:
26+
nix_conf: |
27+
keep-env-derivations = true
28+
keep-outputs = true
29+
- name: Restore and save Nix store
30+
uses: nix-community/cache-nix-action@v6
31+
with:
32+
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
33+
restore-prefixes-first-match: nix-${{ runner.os }}-
34+
gc-max-store-size-linux: 5G
35+
purge: true
36+
purge-prefixes: nix-${{ runner.os }}-
37+
purge-created: 0
38+
purge-last-accessed: 0
39+
purge-primary-key: never
40+
- name: Run checks
41+
run: nix flake check --impure
42+
- name: Build binaries
43+
run: nix build --impure .#webhook-relay
44+
- name: Build image
45+
run: nix build --impure .#server-image
46+
- name: Prepare release artifacts
47+
if: inputs.create-release
48+
run: |
49+
mkdir -p release-artifacts
50+
51+
# Linux binaries
52+
cp result/bin/x86_64-unknown-linux-musl/server release-artifacts/server-x86_64-linux
53+
cp result/bin/x86_64-unknown-linux-musl/client release-artifacts/client-x86_64-linux
54+
cp result/bin/x86_64-unknown-linux-musl/mcp-client release-artifacts/mcp-client-x86_64-linux
55+
56+
# Windows binaries
57+
cp result/bin/x86_64-pc-windows-gnu/server.exe release-artifacts/server-x86_64-windows.exe
58+
cp result/bin/x86_64-pc-windows-gnu/client.exe release-artifacts/client-x86_64-windows.exe
59+
cp result/bin/x86_64-pc-windows-gnu/mcp-client.exe release-artifacts/mcp-client-x86_64-windows.exe
60+
61+
# macOS binaries
62+
cp result/bin/x86_64-apple-darwin/server release-artifacts/server-x86_64-darwin
63+
cp result/bin/x86_64-apple-darwin/client release-artifacts/client-x86_64-darwin
64+
cp result/bin/x86_64-apple-darwin/mcp-client release-artifacts/mcp-client-x86_64-darwin
65+
- name: Create GitHub Release
66+
if: inputs.create-release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
files: release-artifacts/*
70+
generate_release_notes: true
71+
- name: Generate image tag
72+
if: inputs.push-image
73+
id: image-info
74+
run: |
75+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
76+
TAG="${{ github.ref_name }}"
77+
else
78+
TAG="latest"
79+
fi
80+
echo "tag=$TAG" >> $GITHUB_OUTPUT
81+
- name: Load and tag image
82+
if: inputs.push-image
83+
run: |
84+
IMAGE_ID=$(podman load --quiet < ./result | cut -d ' ' -f 3)
85+
podman tag "$IMAGE_ID" "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.image-info.outputs.tag }}"
86+
- name: Push image to GHCR
87+
if: inputs.push-image
88+
uses: redhat-actions/push-to-registry@v2
89+
with:
90+
image: ${{ env.IMAGE_NAME }}
91+
tags: ${{ steps.image-info.outputs.tag }}
92+
registry: ${{ env.REGISTRY }}
93+
username: ${{ github.actor }}
94+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
tags:
7+
- "v*"
8+
jobs:
9+
build-and-release:
10+
uses: ./.github/workflows/build.yaml
11+
with:
12+
push-image: true
13+
create-release: ${{ startsWith(github.ref, 'refs/tags/v') }}
14+
permissions:
15+
contents: write
16+
packages: write

.github/workflows/pr.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: pr
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
jobs:
7+
check-pr:
8+
uses: ./.github/workflows/build.yaml
9+
with:
10+
push-image: false
11+
create-release: false

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.direnv
2+
.devenv
3+
.pre-commit-config.yaml
4+
.helix
5+
target
6+
node_modules
7+
result
8+
result-*
9+
dist
10+
bin
11+
bun.lockb
12+
13+
14+
# Added by cargo
15+
16+
/target

0 commit comments

Comments
 (0)