name: Build & Test Infinito.Nexus CLI in Docker Container

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    timeout-minutes: 15

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Build Docker image
        run: |
          docker build -t infinito:latest .

      - name: Clean build artifacts
        run: |
          docker run --rm infinito:latest make clean

      - name: Generate project outputs
        run: |
          docker run --rm infinito:latest make build

      - name: Run tests
        run: |
          docker run --rm infinito:latest make test
