Skip to content

Commit

Permalink
fix(cd): enable cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Sep 30, 2024
1 parent 3f4f742 commit fe8d1aa
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,91 +17,91 @@ jobs:
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-gnu,
ALL_FEATURES: true,
ARGS: "",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: x86_64-unknown-linux-musl,
ALL_FEATURES: true,
ARGS: "",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-gnu,
ALL_FEATURES: true,
ARGS: "",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: riscv64gc-unknown-linux-gnu,
ALL_FEATURES: true,
ARGS: "",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-gnu,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: i686-unknown-linux-musl,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: aarch64-unknown-linux-musl,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: armv5te-unknown-linux-gnueabi,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: armv7-unknown-linux-gnueabihf,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: arm-unknown-linux-gnueabi,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: arm-unknown-linux-gnueabihf,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: ubuntu-22.04,
TOOLCHAIN: stable,
TARGET: powerpc64le-unknown-linux-gnu,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: windows-2022,
TOOLCHAIN: stable,
TARGET: x86_64-pc-windows-msvc,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: macos-14,
TOOLCHAIN: stable,
TARGET: x86_64-apple-darwin,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
- {
OS: macos-14,
TOOLCHAIN: stable,
TARGET: aarch64-apple-darwin,
ALL_FEATURES: false,
ARGS: "--no-default-features",
}
steps:
- name: Checkout the repository
Expand All @@ -111,22 +111,21 @@ jobs:
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.build.TOOLCHAIN }}
targets: ${{ matrix.build.TARGET }}
target: ${{ matrix.build.TARGET }}
override: true

- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2

- name: Build
shell: bash
run: |
if [ "${{ matrix.build.ALL_FEATURES }}" = true ]; then
cargo build --release --locked --target ${{ matrix.build.TARGET }}
else
cargo build --release --no-default-features --locked --target ${{ matrix.build.TARGET }}
fi
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.build.OS != 'windows-2022' }}
command: build
args: --release --locked --target ${{ matrix.build.TARGET }} ${{ matrix.build.ARGS }}

- name: Prepare release assets
shell: bash
Expand All @@ -136,7 +135,7 @@ jobs:
if [ "${{ matrix.build.OS }}" = "windows-2022" ]; then
cp target/${{ matrix.build.TARGET }}/release/binsider.exe release/
else
cp target/${{ matrix.build.TARGET }}/release/binsider release/ && strip -s release/binsider
cp target/${{ matrix.build.TARGET }}/release/binsider release/
fi
mv release/ binsider-${{env.RELEASE_VERSION}}/
Expand Down

0 comments on commit fe8d1aa

Please sign in to comment.