Skip to content

Commit

Permalink
Add rust-build action to dependencies and update metadata in `Cargo…
Browse files Browse the repository at this point in the history
….toml`

* Add `rust-build` action to `[dependencies]` section with version `1.4.5`
* Update metadata to follow the format specified in the cargo-binstall documentation

Include `rust-build` action in GitHub Actions workflow

* Include `rust-build` action in `build-x86` job for x86_64-unknown-linux-gnu target
* Include `rust-build` action in `build-arm` job for aarch64-apple-darwin target
* Ensure `rust-build` action is specified with the correct version `rust-build/rust-build.action@v1.4.5`
* Ensure the names of the binary or the upload files follow the specified format
  • Loading branch information
oleander committed Nov 16, 2024
1 parent a4ee186 commit 26b3428
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ jobs:
- name: Add target
run: rustup target add x86_64-unknown-linux-gnu

- name: Build for x86_64-unknown-linux-gnu
run: cargo build --release --target x86_64-unknown-linux-gnu

- name: Package Binary
run: tar czf git-ai.tar.gz -C target/*/release git-ai git-ai-hook
- name: Compile
id: compile-x86
uses: rust-build/rust-build.action@v1.4.5
with:
RUSTTARGET: x86_64-unknown-linux-gnu
UPLOAD_MODE: none

- name: Upload Binary
uses: actions/upload-artifact@v4
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: git-ai-x86_64-unknown-linux-gnu.tar.gz
if-no-files-found: error
compression-level: 9
overwrite: true
path: git-ai.tar.gz
name: Binary-x86
path: |
${{ steps.compile-x86.outputs.BUILT_ARCHIVE }}
${{ steps.compile-x86.outputs.BUILT_CHECKSUM }}
build-arm:
runs-on: macos-latest
Expand All @@ -47,20 +47,20 @@ jobs:
- name: Add target
run: rustup target add aarch64-apple-darwin

- name: Build for aarch64-apple-darwin
run: cargo build --release --target aarch64-apple-darwin

- name: Package Binary
run: tar czf git-ai.tar.gz -C target/*/release git-ai git-ai-hook
- name: Compile
id: compile-arm
uses: rust-build/rust-build.action@v1.4.5
with:
RUSTTARGET: aarch64-apple-darwin
UPLOAD_MODE: none

- name: Upload Binary
uses: actions/upload-artifact@v4
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: git-ai-aarch64-apple-darwin.tar.gz
if-no-files-found: error
overwrite: true
compression-level: 9
path: git-ai.tar.gz
name: Binary-arm
path: |
${{ steps.compile-arm.outputs.BUILT_ARCHIVE }}
${{ steps.compile-arm.outputs.BUILT_CHECKSUM }}
release:
needs: [build-x86, build-arm]
Expand Down Expand Up @@ -94,8 +94,8 @@ jobs:
with:
tag_name: "0.2.26"
files: |
git-ai-x86_64-unknown-linux-gnu.tar.gz/git-ai.tar.gz
git-ai-aarch64-apple-darwin.tar.gz/git-ai.tar.gz
Binary-x86
Binary-arm
- name: Publish to crates.io
run: cargo publish --allow-dirty
Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ structopt = "0.3.26"
thiserror = "1.0.61"
tokio = { version = "1.38.0", features = ["rt-multi-thread"] }
tiktoken-rs = { version = "0.5.9" }
rust-build = "0.1.0"

[dev-dependencies]
tempfile = "3.10.1"
Expand All @@ -57,3 +58,11 @@ lto = true
[profile.release.package."*"]
codegen-units = 1
opt-level = 3

[package.metadata.binstall]
name = "git-ai"
default-target = "x86_64-unknown-linux-gnu"
targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin"]

[dependencies]
rust-build = { version = "1.4.5" }

0 comments on commit 26b3428

Please sign in to comment.