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

name: Full Test Suite on Linux

# Controls when the workflow 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:
  # This workflow contains a single job called "runtest"
  runtest:
    strategy:
      fail-fast: false
      matrix:
        cfg: [
          {os: 'ubuntu-22.04', py: '3.7'},
          {os: 'ubuntu-24.04', py: '3.13'},
        ]

    runs-on: ${{ matrix.cfg.os }}

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v4

      - name: Install Ubuntu packages ${{ matrix.cfg.os }}
        run: |
          sudo apt-get update
          sudo apt-get install libtirpc-dev

      - name: Set up Python ${{ matrix.cfg.py }} ${{ matrix.cfg.os }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.cfg.py }}
          cache: 'pip'

      - name: Install Python ${{ matrix.cfg.py }} dependencies ${{ matrix.cfg.os }}
        run: |
          python -m pip install --progress-bar off --upgrade pip
          python -m pip install --progress-bar off -r requirements-dev.txt
          # sudo apt-get update

      - name: runtest ${{ matrix.cfg.os }} ${{ matrix.cfg.py }}
        run: |
          python runtest.py --all --time --jobs=4

      - name: Archive Failed tests ${{ matrix.cfg.os }} ${{ matrix.cfg.py }}
        uses: actions/upload-artifact@v4
        if: failure()
        with:
          name: ${{ matrix.cfg.os }}-${{ matrix.cfg.py }}-failed-tests
          path: |
            failed_tests.log
