name: Test Action

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        package:
          - openssl
          - lolcat
          - termshark
          - deber
          - lazygit
          - tar
          - busybox
        include:
          - package: openssl
            repo: https://salsa.debian.org/debian/openssl.git
            ref: debian/openssl-1.1.1d-0+deb10u2
          - package: lolcat
            repo: https://salsa.debian.org/ruby-team/lolcat.git
            ref: debian/100.0.1-2
          - package: termshark
            repo: https://salsa.debian.org/go-team/packages/termshark.git
            ref: debian/2.0.3-1
          - package: deber
            repo: https://github.com/dawidd6/deber.git
            ref: v1.0.0
          - package: lazygit
            repo: https://github.com/dawidd6/lazygit-debian.git
            ref: ubuntu/0.16.2-1
          - package: tar
            repo: https://git.launchpad.net/ubuntu/+source/tar
            ref: ubuntu/bionic-updates
          - package: busybox
            repo: https://git.launchpad.net/ubuntu/+source/busybox
            ref: ubuntu/focal
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Clone repo
        run: |
          git clone ${{matrix.repo}} -b ${{matrix.ref}} ${{matrix.package}}
      - name: Test run
        uses: ./
        with:
          source_directory: ${{matrix.package}}
          artifacts_directory: artifacts
      - name: Check files
        run: |
          ls -lh artifacts/${{matrix.package}}_*.*
          ls -lh ${{matrix.package}}_*.* && false || true
