on:
  push:
    branches: [main, staging, trying]
  pull_request:
    branches: [main]

name: Continuous integration

jobs:
  test :
    name: test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        target:
          - x86_64-unknown-linux-gnu
          - i686-unknown-linux-musl

    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          target: ${{ matrix.target }}
          override: true

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --target ${{ matrix.target }}

  ci-success:
    name: ci
    if: github.event_name == 'push' && success()
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - name: Mark the job as a success
        run: exit 0
