# Compare the current version of the package with the latest version on PyPI.

name: compare

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  build_package:
    name: Compare current version with latest version on PyPI
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        script: [unconstrained, bound_constrained, linearly_constrained, nonlinearly_constrained]

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

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'

      - name: Setup the comparison
        run: bash .github/actions/compare/setup.sh

      - name: Compare the current version with the latest version on PyPI
        run: python .github/actions/compare/${{ matrix.script }}.py

      - name: Upload artifacts
        uses: actions/upload-artifact@v3
        with:
          path: out
