# This is a basic workflow to help you get started with Actions

name: Synfig Tests CI

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build:
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.allow_failures }}
    name: ${{ matrix.name }}
    strategy:
      matrix:
        include:
        # includes a new variable of npm with a value of 2
        # for the matrix leg matching the os and version
        - os: ubuntu-20.04
          name: Ubuntu 20.04 (Focal)
          allow_failures: false

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v4

      - name: "Synfig Studio (Check appdata.xml)"
        run: |
          sudo apt update
          sudo apt install flatpak
          sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
          sudo flatpak install flathub org.freedesktop.appstream-glib -y
          flatpak run org.freedesktop.appstream-glib validate synfig-studio/org.synfig.SynfigStudio.appdata.xml.in

      - name: "Lottie exporter"
        run: |
          sudo apt install python3-lxml
          ./autobuild/lottie_test.sh
