name: CI

on: [pull_request]

jobs:
  Flatpak:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        arch: [x86_64, aarch64]
      # Don't fail the whole workflow if one architecture fails
      fail-fast: false

    container:
      image: ghcr.io/elementary/flatpak-platform/runtime:6-${{ matrix.arch }}
      options: --privileged

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up QEMU for aarch64 emulation
        if: ${{ matrix.arch != 'x86_64' }}
        uses: docker/setup-qemu-action@v1
        with:
          platforms: arm64

      - name: Build
        uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
        with:
          bundle: easyssh.flatpak
          manifest-path: com.github.muriloventuroso.easyssh.yml
          run-tests: false
          repository-name: appcenter
          repository-url: https://flatpak.elementary.io/repo.flatpakrepo
          cache-key: "flatpak-builder-${{ github.sha }}"
          arch: ${{ matrix.arch }}

  Lint:
    name: Lint
    runs-on: ubuntu-latest
    container:
      image: valalang/lint
    steps:
    - uses: actions/checkout@v2
    - name: Lint
      run: io.elementary.vala-lint -d .
