# This workflow will use Nox to run tests and lint for the supported Python versions, and upload the test coverage data.

name: Test

on:
    push:
        branches:
            - master
            - release/*
    pull_request:
        branches:
            - master

    # Allows you to run this workflow manually from the Actions tab
    workflow_dispatch:

jobs:
    build:
        name: Test on ${{ matrix.os }} with all supported Python versions
        runs-on: ${{ format('{0}', matrix.os)  }} # "-latest" is added here so we can use OS in the format expected by CodeCov

        strategy:
            matrix:
                os: [ubuntu-latest, macos-13]

        steps:
            - uses: actions/checkout@v4
            - name: Setup Nox
              uses: fjwillemsen/setup-nox2@v3.0.0
            - name: Setup Poetry
              uses: Gr1N/setup-poetry@v9
            - run: poetry self add poetry-plugin-export
            - name: Run tests with Nox
              run: |
                  pip install nox-poetry
                  nox -- skip-gpu github-action
            # - name: Upload Coverage report to CodeCov
            #   uses: codecov/codecov-action@v3
            #   with:
            #       token: ${{ secrets.CODECOV_TOKEN }}
            #       files: ./coverage
            #       os: ${{ matrix.os }}
            #       fail_ci_if_error: false # option to Specify if CI pipeline should fail when Codecov runs into errors during upload