name: Build pycoax

on:
  push:
    paths:
      - pycoax/**
      - .github/workflows/pycoax_build.yml

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest

    defaults:
      run:
        working-directory: pycoax

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python 3.8
        uses: actions/setup-python@v5
        with:
          python-version: 3.8

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pylint build
          pip install -r requirements.txt

      - name: Run linter
        run: pylint -E coax

      - name: Run unit tests
        run: ./run_unit_tests.sh

      - name: Build packages
        run: python -m build

      - name: Attach packages
        uses: actions/upload-artifact@v4
        with:
          name: dist
          path: pycoax/dist/
