Some build improvements #1518
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: Rust check/build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
ARCH: x86_64-unknown-linux-gnu | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout source code | |
- uses: actions/checkout@v3 | |
# Cleanup Disk | |
- name: Cleanup Disk | |
run: | | |
df -h; | |
sudo rm -rf /usr/local/lib/android; | |
sudo rm -rf /usr/share/dotnet; | |
df -h | |
# Setup arch target for sidecar build | |
- name: Setup arch target | |
run: | | |
echo "target_arch=$(rustc -Vv | grep host | awk '{print $2 " "}')" >> $GITHUB_ENV; | |
echo "target_ext=" >> $GITHUB_ENV; | |
echo "target_os_name=linux" >> $GITHUB_ENV; | |
- name: Setup env file | |
run: cp .env.template .env | |
# Setup rust toolchain | |
- name: Setup rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
components: clippy | |
# Setup wasm32-wasi toolchain | |
- name: setup wasm32-wasi toolchain | |
run: rustup target add wasm32-wasi | |
# Should help bring down build times | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
key: "1" # increment this to bust the cache if needed | |
- name: Install tauri system deps | |
run: | | |
sudo apt-get update -y | |
make setup-dev-linux | |
make setup-dev | |
- name: Build sidecar | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: -p spyglass | |
# Setup arch targets - linux | |
- name: Move sidecar into place | |
run: | | |
mkdir -p crates/tauri/binaries | |
cp target/debug/spyglass${{ env.target_ext }} crates/tauri/binaries/spyglass-server-${{ env.target_arch }}${{ env.target_ext }} | |
cp target/debug/spyglass-debug${{ env.target_ext }} crates/tauri/binaries/spyglass-debug-${{ env.target_arch }}${{ env.target_ext }} | |
cp utils/${{ env.target_os_name }}/pdftotext${{ env.target_ext }} crates/tauri/binaries/pdftotext-${{ env.target_arch }}${{ env.target_ext }} | |
# Build front-end client | |
- name: Build client | |
env: | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: tauri | |
args: build --verbose | |
# Build backend crates | |
- name: Build backend | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: -p spyglass | |
# Run tests | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all | |
# Run clippy | |
- name: Run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings | |
# make sure we ran fmt | |
- name: run fmt check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all --check | |
# Run spyglass backend in check mode to validate migrations & other basic startup | |
# procedures. | |
- name: run spyglass checks | |
run: cargo run -p spyglass -- --check |