-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: release | |
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
jobs: | ||
create-release: | ||
name: create-release | ||
|
@@ -28,7 +28,7 @@ jobs: | |
|
||
build-release: | ||
name: build-release | ||
needs: ['create-release'] | ||
needs: ["create-release"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CARGO: cargo | ||
|
@@ -37,80 +37,75 @@ jobs: | |
RUST_BACKTRACE: 1 | ||
strategy: | ||
matrix: | ||
build: [linux, linux-arm, macos] | ||
build: [linux, linux-arm, linux-arm64, macos, macos-m1] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
rust: stable | ||
target: x86_64-unknown-linux-musl | ||
- build: linux-arm | ||
os: ubuntu-latest | ||
rust: stable | ||
target: arm-unknown-linux-gnueabihf | ||
- build: macos | ||
os: macos-latest | ||
rust: stable | ||
target: x86_64-apple-darwin | ||
- build: linux | ||
os: ubuntu-latest | ||
rust: stable | ||
target: x86_64-unknown-linux-musl | ||
- build: linux-arm | ||
os: ubuntu-latest | ||
rust: stable | ||
target: arm-unknown-linux-gnueabihf | ||
- build: linux-arm64 | ||
os: ubuntu-latest | ||
rust: stable | ||
target: aarch64-unknown-linux-gnu | ||
- build: macos | ||
os: macos-latest | ||
rust: stable | ||
target: x86_64-apple-darwin | ||
- build: macos-m1 | ||
os: macos-latest | ||
rust: stable | ||
target: aarch64-apple-darwin | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
target: ${{ matrix.target }} | ||
|
||
- name: Use Cross | ||
shell: bash | ||
run: | | ||
cargo install cross | ||
echo "CARGO=cross" >> $GITHUB_ENV | ||
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV | ||
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Show command used for Cargo | ||
run: | | ||
echo "cargo command is: ${{ env.CARGO }}" | ||
echo "target flag is: ${{ env.TARGET_FLAGS }}" | ||
echo "target dir is: ${{ env.TARGET_DIR }}" | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
target: ${{ matrix.target }} | ||
|
||
- name: Build release binary | ||
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} | ||
- name: Use Cross | ||
shell: bash | ||
run: | | ||
cargo install cross | ||
echo "CARGO=cross" >> $GITHUB_ENV | ||
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV | ||
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | ||
- name: Strip release binary (linux and macos) | ||
if: matrix.build == 'linux' || matrix.build == 'macos' | ||
run: strip "target/${{ matrix.target }}/release/findlargedir" | ||
- name: Show command used for Cargo | ||
run: | | ||
echo "cargo command is: ${{ env.CARGO }}" | ||
echo "target flag is: ${{ env.TARGET_FLAGS }}" | ||
echo "target dir is: ${{ env.TARGET_DIR }}" | ||
- name: Strip release binary (arm) | ||
if: matrix.build == 'linux-arm' | ||
run: | | ||
docker run --rm -v \ | ||
"$PWD/target:/target:Z" \ | ||
rustembedded/cross:arm-unknown-linux-gnueabihf \ | ||
arm-linux-gnueabihf-strip \ | ||
/target/arm-unknown-linux-gnueabihf/release/findlargedir | ||
- name: Build release binary | ||
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")" | ||
staging="findlargedir-${{ needs.create-release.outputs.fl_version }}-${{ matrix.target }}" | ||
mkdir -p "$staging" | ||
cp {README.md,LICENSE} "$staging" | ||
cp "target/${{ matrix.target }}/release/findlargedir" "$staging" | ||
tar -cJf "$staging.tar.xz" "$staging" | ||
echo "ASSET=$staging.tar.xz" >> $GITHUB_ENV | ||
- name: Build archive | ||
shell: bash | ||
run: | | ||
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")" | ||
staging="findlargedir-${{ needs.create-release.outputs.fl_version }}-${{ matrix.target }}" | ||
mkdir -p "$staging" | ||
cp {README.md,LICENSE} "$staging" | ||
cp "target/${{ matrix.target }}/release/findlargedir" "$staging" | ||
tar -cJf "$staging.tar.xz" "$staging" | ||
echo "ASSET=$staging.tar.xz" >> $GITHUB_ENV | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ fs-err = "2.8.1" | |
|
||
[profile.release] | ||
lto = true | ||
strip = true |