Skip to content

Add serial transport #169

Add serial transport

Add serial transport #169

Workflow file for this run

name: Rust
on:
push:
paths:
- "Cargo.toml"
- "src/**"
- "devices/**"
- "!**.md"
- ".github/workflows/rust.yml"
pull_request:
branches: [ main ]
paths:
- "Cargo.toml"
- "src/**"
- "devices/**"
- "!**.md"
- ".github/workflows/rust.yml"
workflow_dispatch:
release:
types:
- created
schedule: # Every day at the 2 P.M. (UTC) we run a scheduled nightly build
- cron: "0 14 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build (${{ matrix.config.arch }})
strategy:
matrix:
config:
- os: windows-latest
arch: win-x64
- os: ubuntu-latest
arch: linux-x64
- os: ubuntu-latest
arch: linux-aarch64
- os: macos-latest
arch: macos-arm64
- os: macos-12
arch: macos-x64
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Configure target
run: |
if [[ "${{ matrix.config.arch }}" == "linux-aarch64" ]]; then
rustup target add aarch64-unknown-linux-gnu
sudo apt-get install gcc-aarch64-linux-gnu
echo TARGET="--target aarch64-unknown-linux-gnu" >> $GITHUB_ENV
echo RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
else
echo TARGET="" >> $GITHUB_ENV
fi
shell: bash
- name: Build
run: cargo build --release ${{ env.TARGET }}
- name: Run tests
if: matrix.config.arch != 'linux-aarch64'
run: cargo test --release ${{ env.TARGET }}
- name: Run help
if: matrix.config.arch != 'linux-aarch64'
run: cargo run --release ${{ env.TARGET }} -- --help
- name: Prepare artifacts
run: |
if [[ "${{ matrix.config.arch }}" == "win-x64" ]]; then
WCHISP_EXE="target/release/wchisp.exe"
elif [[ "${{ matrix.config.arch }}" == "linux-aarch64" ]]; then
WCHISP_EXE="target/aarch64-unknown-linux-gnu/release/wchisp"
else
WCHISP_EXE="target/release/wchisp"
fi
mkdir wchisp-${{ matrix.config.arch }}
cp $WCHISP_EXE wchisp-${{ matrix.config.arch }}
cp README.md wchisp-${{ matrix.config.arch }}
shell: bash
- uses: actions/upload-artifact@v4
with:
name: wchisp-${{ matrix.config.arch }}
path: wchisp-${{ matrix.config.arch }}
- name: Prepare Release Asset
if: github.event_name == 'release'
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
7z a -tzip wchisp-${{ github.event.release.tag_name }}-${{ matrix.config.arch }}.zip wchisp-${{ matrix.config.arch }}
else
tar -czvf wchisp-${{ github.event.release.tag_name }}-${{ matrix.config.arch }}.tar.gz wchisp-${{ matrix.config.arch }}
fi
shell: bash
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
fail_on_unmatched_files: false
files: |
wchisp-*.tar.gz
wchisp-*.zip
nightly-release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./
- name: Prepare Nightly Asset
run: |
ls -R ./
for f in wchisp-*; do
echo "Compressing $f"
if [[ $f == wchisp-win* ]]; then
zip -r $f.zip $f
else
tar -czvf $f.tar.gz $f
fi
done
ls ./
- name: Update Nightly Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: "wchisp nightly release $$"
draft: false
prerelease: true
body: |
This is a nightly binary release of the wchisp command line tool.
files: |
wchisp-*.tar.gz
wchisp-*.zip