name: 'Smoketest for Lyrion Music Server'
on:
  push:
  workflow_dispatch:
  pull_request_target:
    types: [assigned, labeled]
jobs:
  linux:
    name: Run LMS to see whether it crashes immediately...
    runs-on: ubuntu-24.04

    steps:
      - name: Make sure we're running as non-root
        run: |
          if [ "$RUNNER_USER" == "root" ]; then
            echo Specify non-root image when testing with act:
            echo act -P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:runner-24.04
            exit 1
          fi

      - uses: actions/checkout@v6

      - name: Install dependencies
        if: ${{ !env.ACT }}
        uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: libio-socket-ssl-perl libnet-ssleay-perl netcat-traditional
          version: 1

      - name: Install dependencies (ACT fallback)
        if: ${{ env.ACT }}
        run: |
          sudo apt-get update
          sudo apt-get install -y libio-socket-ssl-perl libnet-ssleay-perl netcat-traditional

      - name: Test Strings File
        run: perl -ICPAN t/verifyStrings.pl

      - name: Run Startup Test
        run: bash t/00_smoketest.sh
