Skip to content

Commit a6f1faa

Browse files
authored
Build and deploy prebuilt binaries (#19)
* Update deploy.yml * Update deploy.yml * Patch bug * Update version * Fix con * Add cross-compilation setup to deployment workflow * Simplify concurrency group config in workflows * Fix concurrency group prefix in deploy workflow * Refactor deploy workflow to separate x86 and arm builds * Fix concurrency group syntax in deploy workflow * Update GitHub workflows for consistency across CD and deploy files * Remove pull_request trigger from deploy workflow
1 parent 46a7b7d commit a6f1faa

File tree

9 files changed

+92
-10
lines changed

9 files changed

+92
-10
lines changed

.devcontainer/devcontainer.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/rust:latest",
3+
"tasks": {
4+
"test": "cargo test",
5+
"build": "cargo build",
6+
"launch": "cargo fmt --check"
7+
}
8+
}

.github/workflows/cd.yml

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
types: [opened, synchronize, reopened]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
711
env:
812
CARGO_TERM_COLOR: always
913

@@ -42,6 +46,7 @@ jobs:
4246
command: fmt
4347
args: -- --check
4448
test:
49+
needs: lint
4550
strategy:
4651
fail-fast: true
4752
matrix:

.github/workflows/crate.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Crate
22

33
on:
4-
pull_request:
5-
types: [closed]
6-
branches: [main]
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
711

812
permissions:
913
contents: write

.github/workflows/deploy.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Precompile Binaries
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-x86:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install Rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
override: true
24+
components: rustfmt, clippy
25+
26+
- name: Build for x86_64-unknown-linux-gnu
27+
run: |
28+
rustup target add x86_64-unknown-linux-gnu
29+
cargo build --release --target x86_64-unknown-linux-gnu
30+
31+
- name: Install cargo-binstall
32+
run: cargo install cargo-binstall
33+
34+
- name: Upload binaries
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: binaries-x86_64
38+
path: target/x86_64-unknown-linux-gnu/release/
39+
40+
build-arm:
41+
runs-on: macos-latest
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: Install Rust
47+
uses: actions-rs/toolchain@v1
48+
with:
49+
toolchain: stable
50+
override: true
51+
components: rustfmt, clippy
52+
53+
- name: Build for aarch64-apple-darwin
54+
run: |
55+
rustup target add aarch64-apple-darwin
56+
cargo build --release --target aarch64-apple-darwin
57+
58+
- name: Install cargo-binstall
59+
run: cargo install cargo-binstall
60+
61+
- name: Upload binaries
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: binaries-arm
65+
path: target/aarch64-apple-darwin/release/

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ reorder_modules = false
2020
newline_style = "Auto"
2121
fn_call_width = 90
2222
hard_tabs = false
23-
version = "Two"
23+
style_edition = "2021"
2424
max_width = 140
2525
tab_spaces = 2
2626

src/install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use colored::Colorize;
21
use anyhow::{bail, Result};
32
use ai::filesystem::Filesystem;
3+
use colored::Colorize;
44
use console::Emoji;
55

66
const EMOJI: Emoji<'_, '_> = Emoji("🔗", "");

src/model.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::default::Default;
2-
use std::str::FromStr;
32
use std::fmt::{self, Display};
3+
use std::str::FromStr;
44

55
use anyhow::{bail, Result};
66
use serde::{Deserialize, Serialize};

src/uninstall.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::path::{Path, PathBuf};
22
use std::{env, fs};
33

4-
use colored::Colorize;
4+
use anyhow::{bail, Context, Result};
55
use ai::style::Styled;
6+
use colored::Colorize;
67
use console::Emoji;
78
use git2::{Repository, RepositoryOpenFlags as Flags};
8-
use anyhow::{bail, Context, Result};
99
use thiserror::Error;
1010

1111
#[derive(Error, Debug)]

0 commit comments

Comments
 (0)