chore(deps): refresh project dependencies #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dependency refresh | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, reopened, synchronize] | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: dependency-refresh-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| refresh-and-verify: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --quiet --upgrade pip pipx | |
| pipx install --quiet poetry==2.1.1 | |
| pipx inject --quiet poetry poetry-plugin-export | |
| - name: Refresh dependency lock files | |
| run: | | |
| if ! poetry update --no-interaction --no-ansi > poetry-update.log 2>&1; then | |
| cat poetry-update.log | |
| exit 1 | |
| fi | |
| poetry export --without-hashes --output requirements.txt | |
| poetry check --lock | |
| git diff --check | |
| git diff --stat -- poetry.lock requirements.txt | |
| - name: Commit refreshed lock files | |
| run: | | |
| if git diff --quiet -- poetry.lock requirements.txt; then | |
| echo "Dependency lock files are already current." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add poetry.lock requirements.txt | |
| git commit -m "chore(deps): refresh locked dependencies" | |
| git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
| - name: Install development dependencies | |
| run: | | |
| if ! poetry install --with dev --no-interaction --no-ansi > poetry-install.log 2>&1; then | |
| cat poetry-install.log | |
| exit 1 | |
| fi | |
| - name: Run unit tests | |
| id: unit_tests | |
| continue-on-error: true | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| set -o pipefail | |
| poetry run pytest -q --tb=short --disable-warnings --cov=promptulate --cov-report=term tests/basic 2>&1 | tee pytest.log | |
| - name: Run style checks | |
| id: style_checks | |
| continue-on-error: true | |
| run: | | |
| set -o pipefail | |
| make check-codestyle 2>&1 | tee style.log | |
| - name: Build package | |
| id: package_build | |
| continue-on-error: true | |
| run: | | |
| set -o pipefail | |
| poetry build 2>&1 | tee build.log | |
| - name: Upload validation logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dependency-refresh-diagnostics | |
| path: | | |
| poetry-update.log | |
| poetry-install.log | |
| pytest.log | |
| style.log | |
| build.log | |
| if-no-files-found: ignore | |
| - name: Enforce validation results | |
| if: always() | |
| env: | |
| UNIT_TESTS: ${{ steps.unit_tests.outcome }} | |
| STYLE_CHECKS: ${{ steps.style_checks.outcome }} | |
| PACKAGE_BUILD: ${{ steps.package_build.outcome }} | |
| run: | | |
| printf 'unit-tests=%s\nstyle-checks=%s\npackage-build=%s\n' "$UNIT_TESTS" "$STYLE_CHECKS" "$PACKAGE_BUILD" | |
| test "$UNIT_TESTS" = success | |
| test "$STYLE_CHECKS" = success | |
| test "$PACKAGE_BUILD" = success | |
| python38-compatibility: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --quiet --upgrade pip | |
| python -m pip install --quiet poetry | |
| poetry --version | tee python38-poetry.log | |
| - name: Install development dependencies | |
| id: install_dependencies | |
| continue-on-error: true | |
| run: | | |
| set -o pipefail | |
| poetry install --with dev --no-interaction --no-ansi 2>&1 | tee python38-install.log | |
| - name: Run Python 3.8 unit tests | |
| id: python38_tests | |
| if: steps.install_dependencies.outcome == 'success' | |
| continue-on-error: true | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| set -o pipefail | |
| poetry run pytest -q --tb=short --disable-warnings --cov=promptulate --cov-report=term tests/basic 2>&1 | tee python38-pytest.log | |
| - name: Upload Python 3.8 diagnostics | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python38-compatibility-diagnostics | |
| path: | | |
| python38-poetry.log | |
| python38-install.log | |
| python38-pytest.log | |
| if-no-files-found: ignore | |
| - name: Enforce Python 3.8 compatibility | |
| if: always() | |
| env: | |
| INSTALL_RESULT: ${{ steps.install_dependencies.outcome }} | |
| TEST_RESULT: ${{ steps.python38_tests.outcome }} | |
| run: | | |
| printf 'install=%s\ntests=%s\n' "$INSTALL_RESULT" "$TEST_RESULT" | |
| test "$INSTALL_RESULT" = success | |
| test "$TEST_RESULT" = success |