This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
176 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
format: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cargo fmt | ||
run: cargo fmt --all -- --check | ||
|
||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# For some builds, we use cross to test on 32-bit and big-endian systems. | ||
CARGO: cargo | ||
# When CARGO is set to CROSS, this is set to `--target matrix.target`. | ||
TARGET_FLAGS: "" | ||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | ||
TARGET_DIR: ./target | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [linux, macos, windows] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- build: linux | ||
os: ubuntu-latest | ||
target: aarch64_be-unknown-linux-gnu | ||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
- build: macos | ||
os: macos-latest | ||
target: aarch64-apple-darwin | ||
- build: windows | ||
os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- build: windows | ||
os: windows-latest | ||
target: aarch64-pc-windows-msvc | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
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: 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: Build | ||
run: ${{ env.CARGO }} build --verbose ${{ env.TARGET_FLAGS }} | ||
|
||
- name: Run tests | ||
run: ${{ env.CARGO }} test --verbose ${{ env.TARGET_FLAGS }} |
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# For some builds, we use cross to test on 32-bit and big-endian systems. | ||
CARGO: cargo | ||
# When CARGO is set to CROSS, this is set to `--target matrix.target`. | ||
TARGET_FLAGS: "" | ||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | ||
TARGET_DIR: ./target | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [linux, linux-arm, macos, windows] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- build: linux-arm | ||
os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
- build: macos | ||
os: macos-latest | ||
target: aarch64-apple-darwin | ||
- build: windows | ||
os: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
- build: windows | ||
os: windows-latest | ||
target: aarch64-pc-windows-msvc | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
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: 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: Build release binary | ||
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} | ||
|
||
- name: Strip release binary (linux and macos) | ||
if: matrix.build == 'linux' || matrix.build == 'macos' | ||
run: strip "target/${{ matrix.target }}/release/strend" | ||
|
||
- name: Strip release binary (arm) | ||
if: matrix.build == 'linux-arm' | ||
run: | | ||
docker run --rm -v \ | ||
"$PWD/target:/target:Z" \ | ||
rustembedded/cross:aarch64-unknown-linux-gnu \ | ||
aarch64-linux-gnu-strip \ | ||
/target/aarch64-unknown-linux-gnu/release/strend | ||
- name: Publish | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./release/* |