# run this action when the repository is pushed to
on: [push]

# the name of our workflow
name: FanslySync Build & Test

jobs:
  # a single job named test
  test:
    # the display name of the test job
    name: FanslySync Test Runner

    # we want to run on the latest linux environment
    runs-on: ubuntu-latest

    # the steps our job runs **in order**
    steps:
      # checkout the code on the workflow runner
      - uses: actions/checkout@v2

      # install system dependencies that Tauri needs to compile on Linux.
      # note the extra dependencies for `tauri-driver` to run which are: `webkit2gtk-driver` and `xvfb`
      - name: Tauri dependencies
        run: >-
          sudo apt-get update &&
          sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

      # install the latest Rust stable
      - name: Rust stable
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      # Run our cargo commands in `src-tauri` directory
      - name: Build And Test
        run: >-
          cd src-tauri &&
          cargo test &&
          cargo build --release