diff --git a/.github/workflows/poetry-requirements.yml b/.github/workflows/poetry-requirements.yml new file mode 100644 index 00000000..6896058f --- /dev/null +++ b/.github/workflows/poetry-requirements.yml @@ -0,0 +1,47 @@ +name: Poetry requirements + +on: + push: + branches: + - 'development' + +jobs: + check_poetry_requirements: + name: 'Python ${{ matrix.python-version }}' + runs-on: ubuntu-latest + timeout-minutes: 10 # Don't run forever when stale + strategy: + matrix: + python-version: + - '3.11' + steps: + - uses: actions/checkout@v4 + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cached dependencies & virtualenv + uses: actions/cache@v4 + with: + path: | + ~/.cache/pypoetry/ + ~/dsmr-reader/.venv + key: dependencies-update-check-${{ hashFiles('poetry.lock') }} + + - name: Export Poetry lock file + run: | + pip install --upgrade pip poetry + poetry self add poetry-plugin-export + poetry config virtualenvs.in-project true + poetry check + poetry run pip install -r + + poetry export -f requirements.txt --without-urls --without-hashes --without dev --output poetry-export-base.txt + poetry export -f requirements.txt --without-urls --without-hashes --only dev --output poetry-export-dev.txt + + - name: Compare Poetry export with requirements files + run: | + diff poetry-export-base.txt $GITHUB_WORKSPACE/dsmrreader/provisioning/requirements/base.txt + diff poetry-export-dev.txt $GITHUB_WORKSPACE/dsmrreader/provisioning/requirements/dev.txt