Add MySQL and Postgres port precedence tests; refactor environment variable checks #1264
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: Build, test, & publish | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - major-release | |
| release: | |
| types: | |
| - published | |
| permissions: read-all | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| CACHE_GLOBS: | | |
| **/pyproject.toml | |
| **/setup.py | |
| **/uv.lock | |
| steps: | |
| - uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b | |
| with: | |
| python-version: 3.13 | |
| activate-environment: true | |
| cache-dependency-glob: ${{ env.CACHE_GLOBS }} | |
| - run: >- | |
| uv sync | |
| --upgrade | |
| --all-extras | |
| - run: >- | |
| uv build | |
| --sdist | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: parsons-dist | |
| path: dist/ | |
| test: | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| - macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| name: parsons-dist | |
| path: dist | |
| - name: extract requirements.txt for use in pip cache | |
| shell: bash | |
| run: | | |
| file=$(find ./dist -name 'parsons-*.tar.gz' | head -1) | |
| # Extract to a temp directory first | |
| mkdir -p temp_extract | |
| tar -xzf "$file" -C temp_extract | |
| # Find and move pyproject file to root | |
| find temp_extract -name 'pyproject.toml' -exec cp {} . \; 2>/dev/null || true | |
| # Clean up | |
| rm -rf temp_extract | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: install parsons from file | |
| shell: bash | |
| run: | | |
| file=$(find ./dist -name 'parsons-*.tar.gz' | head -1) | |
| pip install "$file" | |
| publish: | |
| if: github.repository_owner == 'move-coop' && github.event_name == 'release' && github.event.action == 'published' | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| name: parsons-dist | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b | |
| with: | |
| verify-metadata: true | |
| skip-existing: true | |
| packages-dir: dist | |
| verbose: true |