name: CI
on:
  push:
    branches: ["feature/**", "bugfix/**", "hotfix/**"]
  pull_request:
    branches: [main]

jobs:
  lint:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          python3 -m pip install --user --upgrade pip setuptools wheel
          python3 -m pip install --user ".[dev]"
      - name: Lint
        run: |
          export PATH="$HOME/.local/bin:$PATH"
          ruff check src/

  test:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          python3 -m pip install --user --upgrade pip setuptools wheel
          python3 -m pip install --user ".[dev]"
      - name: Test
        run: |
          export PATH="$HOME/.local/bin:$PATH"
          pytest tests/

  build:
    runs-on: self-hosted
    needs: [lint, test]
    steps:
      - uses: actions/checkout@v4
      - name: Build Docker image
        run: docker build -t enduro-trails:ci .
