name: "AM test suite 🧪"

env:
  TERM: xterm

on:
  push:
    branches: '**'
    paths:
      - 'modules/**'
      - INSTALL
      - APP-MANAGER
      - '!programs/**'
  pull_request:
    branches: '**'
    paths:
      - 'modules/**'
      - INSTALL
      - APP-MANAGER
      - '!programs/**'
  workflow_dispatch:
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:

  am:
    name: Install AM 📝
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install AM
        run: |
          ls -al .github/workflows
          printf '\tSetting up environment...\n'
          printf '\n\tCreating directory structure...\n'
          mkdir -p results /usr/local/bin
          # printf '\n\tUpgrading ubuntu host...\n'
          # sudo apt update && sudo apt upgrade
          printf '\n\tInstalling dependencies...\n'
          sudo apt install -y wget curl zsync 2> /dev/null
          printf '\n\tMaking needed files executable...\n'
          chmod +x ./INSTALL .github/workflows/test.sh
          printf '\n\tInstalling AM...\n'
          sudo ./INSTALL
          printf '\n'
          echo "Installed version: $(am version)"
          printf '\n\tRunning tests...\n'
          .github/workflows/test.sh
          printf '\n\tTest finished succesfully\n'

  # t:
    # name: t
    # runs-on: ubuntu-latest
    # steps:
      # - uses: actions/checkout@v4
      # - name: t
        # run: |
          # printf '\t...\n\n'
          # printf '\n\n\t...\n\n'
          # echo hello
          # printf '\n\n\tDONE\n\n'
