1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Release
on:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
validate:
name: Validate Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.94
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-release-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-release-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features
build-binaries:
name: Build (${{ matrix.name }})
needs: validate
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: agentmail
archive: agentmail-linux-x86_64.tar.gz
- name: linux-aarch64
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
binary: agentmail
archive: agentmail-linux-aarch64.tar.gz
- name: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
binary: agentmail
archive: agentmail-macos-x86_64.tar.gz
- name: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
binary: agentmail
archive: agentmail-macos-aarch64.tar.gz
- name: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
binary: agentmail.exe
archive: agentmail-windows-x86_64.zip
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.94
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-release-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-release-cargo-
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ matrix.archive }} ${{ matrix.binary }}
cd ../../..
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "target/${{ matrix.target }}/release/${{ matrix.binary }}" -DestinationPath "${{ matrix.archive }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.archive }}
# Build macOS universal binary from the two arch-specific builds
build-macos-universal:
name: Build (macos-universal)
needs: build-binaries
runs-on: macos-latest
steps:
- name: Download macOS artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create universal binary
run: |
mkdir -p work
cd work
tar xzf ../artifacts/macos-aarch64/agentmail-macos-aarch64.tar.gz
mv agentmail agentmail-arm64
tar xzf ../artifacts/macos-x86_64/agentmail-macos-x86_64.tar.gz
mv agentmail agentmail-x86_64
lipo -create -output agentmail agentmail-arm64 agentmail-x86_64
file agentmail
tar czf ../agentmail-macos-universal.tar.gz agentmail
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-universal
path: agentmail-macos-universal.tar.gz
create-release:
name: Create GitHub Release
needs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect release assets
run: |
mkdir -p release
cp artifacts/linux-x86_64/*.tar.gz release/
cp artifacts/linux-aarch64/*.tar.gz release/
cp artifacts/macos-x86_64/*.tar.gz release/
cp artifacts/macos-aarch64/*.tar.gz release/
cp artifacts/macos-universal/*.tar.gz release/
cp artifacts/windows-x86_64/*.zip release/
ls -lh release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: release/*
publish-crates-io:
name: Publish to crates.io
needs: validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.94
- name: Update lockfile
run: cargo generate-lockfile
- name: Publish agentmail (library + binary + mcp)
run: cargo publish -p agentmail
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}