name: main

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        arch: [x64, arm]
        target: [lib, exe, daemon, deb]
    steps:
      - uses: actions/checkout@v2
      - name: Build
        run: make ${{ matrix.arch }}-${{ matrix.target }}
      - uses: actions/upload-artifact@v2
        if: matrix.target == 'deb'
        with:
          name: sectora-${{ matrix.arch }}
          path: ${{ github.workspace }}/target/*/debian/*.deb

  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/download-artifact@v2
        with:
          name: sectora-x64
          path: target
      - name: Run tests
        run: make test-deb
        working-directory: test
        env:
          COMPOSE_INTERACTIVE_NO_CLI: 1
          TERM: xterm-256color

name: main

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        arch: [x64, arm]
        target: [lib, exe, daemon, deb]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v1
        with:
          path: .cargo-${{ matrix.arch }}
          key: ${{ matrix.arch }}-${{ hashFiles('Cargo.lock') }}
      - name: Build
        run: make ${{ matrix.arch }}-${{ matrix.target }}
      - uses: actions/upload-artifact@v2
        if: matrix.target == 'deb'
        with:
          name: sectora-${{ matrix.arch }}
          path: ${{ github.workspace }}/target/*/debian/*.deb

  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/download-artifact@v2
        with:
          name: sectora-x64
          path: target
      - name: Run tests
        run: make test-deb
        working-directory: test
        env:
          COMPOSE_INTERACTIVE_NO_CLI: 1
          TERM: xterm-256color

Use cache on GitHub Actions
Use cache on GitHub Actions
