Fix: CI type e clippy tests #2
Workflow file for this run
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
name: Test all targets | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
jobs: | |
quick-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions-rs/toolchain@v1.0.6 | |
with: | |
toolchain: stable | |
override: true | |
- name: Check Type | |
run: cargo fmt -- --check | |
- name: Check Clippy | |
run: cargo clippy | |
- name: Build | |
run: cargo build | |
build-bin: | |
needs: quick-tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- TARGET: armv7-unknown-linux-gnueabihf | |
- TARGET: aarch64-unknown-linux-gnu | |
- TARGET: armv7-unknown-linux-musleabihf | |
- TARGET: aarch64-unknown-linux-musl | |
steps: | |
- name: Building ${{ matrix.TARGET }} | |
run: echo "${{ matrix.TARGET }}" | |
- uses: actions/checkout@v3 | |
- name: Rust Setup | |
uses: actions-rs/toolchain@v1.0.1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.TARGET }} | |
override: true | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "rust-cache" | |
shared-key: "build-bin-${{ matrix.TARGET }}" | |
- name: Rust Cross Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --verbose --release --target=${{ matrix.TARGET }} | |
- name: Move to it's target | |
run: | | |
mkdir dist | |
mkdir "dist/${{ matrix.TARGET }}" | |
mv $(find "./target" -type f -name "navigator-webassistant") "dist/${{ matrix.TARGET }}" | |
- name: Upload bin | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.TARGET }} | |
path: dist/${{ matrix.TARGET }} | |
- name: Upload bin | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bin | |
path: dist | |
test-local: | |
needs: build-bin | |
runs-on: raspbian-armv7-kernel-5.10.33 | |
steps: | |
- uses: actions/checkout@master | |
- name: Download bin | |
uses: actions/download-artifact@v3 | |
with: | |
name: armv7-unknown-linux-gnueabihf | |
path: dist | |
- name: Run in background | |
run: | | |
chmod +x ./dist/navigator-webassistant | |
./dist/navigator-webassistant > navigator.log 2>&1 & | |
PID=$! | |
sleep 10 | |
if ps -p $PID > /dev/null; then | |
echo "navigator-webassistant started successfully with PID $PID." | |
else | |
echo "Error: navigator-webassistant failed to start." | |
exit 1 | |
fi | |
kill $PID |