Skip to content

Commit

Permalink
Refactor build process and remove Cross.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Aitthi committed Sep 29, 2024
1 parent 0cb9aba commit 695bb49
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/Ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,45 @@ jobs:
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Install xtask
run: cargo install cargo-xtask
# - name: Build Linux binary x86_64-gnu
# run: |
# cross build --target x86_64-unknown-linux-gnu --release
# mkdir -p build/linux-gnu/
# cp target/x86_64-unknown-linux-gnu/release/easy-proxy build/linux-gnu/

- name: Install configure-crosstool
run: cargo xtask configure-crosstool aarch64-apple-darwin x86_64-apple-darwin

- name: Build Linux binary x86_64-gnu
run: |
cross build --target x86_64-unknown-linux-gnu --release
mkdir -p build/linux-gnu/
cp target/x86_64-unknown-linux-gnu/release/easy-proxy build/linux-gnu/
- name: Build Linux binary x86_64-musl
run: |
cross build --target x86_64-unknown-linux-musl --release
mkdir -p build/linux-musl/
cp target/x86_64-unknown-linux-musl/release/easy-proxy build/linux-musl/
# - name: Build Linux binary x86_64-musl
# run: |
# cross build --target x86_64-unknown-linux-musl --release
# mkdir -p build/linux-musl/
# cp target/x86_64-unknown-linux-musl/release/easy-proxy build/linux-musl/

- name: Build Linux binary aarch64-gnu
run: |
cross build --target aarch64-unknown-linux-gnu --release
mkdir -p build/linux-gnu/
cp target/aarch64-unknown-linux-gnu/release/easy-proxy build/linux-gnu/
- name: Build Linux binary aarch64-musl
# - name: Build Linux binary aarch64-musl
# run: |
# cross build --target aarch64-unknown-linux-musl --release
# mkdir -p build/linux-musl/
# cp target/aarch64-unknown-linux-musl/release/easy-proxy build/linux-musl/

- name: Install jq
run: sudo apt-get install -y jq

- name: Extract version from Cargo.toml
id: extract_version
run: |
cross build --target aarch64-unknown-linux-musl --release
mkdir -p build/linux-musl/
cp target/aarch64-unknown-linux-musl/release/easy-proxy build/linux-musl/
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
echo "version=$VERSION" >> $GITHUB_OUTPUT
# push binaries to release
- name: Push binaries to release
uses: softprops/action-gh-release@v1
with:
files: |
build/linux-gnu/easy-proxy
build/linux-musl/easy-proxy
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
title: ${{ github.ref }}
tag_name: v${{ steps.extract_version.outputs.version }}
name: v${{ steps.extract_version.outputs.version }}

0 comments on commit 695bb49

Please sign in to comment.