/
niceSOFT
/
python3-attrs
Обзор
Документация
Войти
/
niceSOFT
/
python3-attrs
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/ci.yml
248 строк
7 KB
Hynek Schlawack
ci: don't rely on uv's Python downloads for lint
04 авг 2026, 08:28
04 авг 2026, 08:28
24cbcf1
Код
Авторство
О чём код?
--- name: CI on: merge_group: push: branches: [main] tags: ["*"] pull_request: workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: FORCE_COLOR: "1" PIP_DISABLE_PIP_VERSION_CHECK: "1" PIP_NO_PYTHON_VERSION_WARNING: "1" permissions: {} jobs: build-package: name: Build & verify package runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - uses: hynek/build-and-inspect-python-package@2abe76da66d0a6a4a227101f9348ee855797cfa5 # v3.0.1 id: baipp outputs: # Used to define the matrix for tests below. The value is based on # packaging metadata (trove classifiers). supported-python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }} tests: name: Tests & Mypy on ${{ matrix.python-version }} runs-on: ubuntu-latest needs: build-package strategy: fail-fast: false matrix: # Created by the build-and-inspect-python-package action above. python-version: ${{ fromJson(needs.build-package.outputs.supported-python-versions) }} env: PYTHON: ${{ matrix.python-version }} steps: - name: Download pre-built packages uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: Packages path: dist - run: tar xf dist/*.tar.gz --strip-components=1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - run: > uv run --only-group tox tox run -e $PYTHON-mypy - name: Remove src to ensure tests run against wheel run: rm -rf src - run: > uv run --only-group tox tox run --installpkg dist/*.whl -e $PYTHON-tests - name: Upload coverage data uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: coverage-data-${{ matrix.python-version }} path: .coverage.* include-hidden-files: true if-no-files-found: ignore tests-pypy: name: Tests on ${{ matrix.python-version }} runs-on: ubuntu-latest needs: build-package strategy: fail-fast: false matrix: python-version: - pypy-3.11 steps: - name: Download pre-built packages uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: Packages path: dist - run: | tar xf dist/*.tar.gz --strip-components=1 rm -rf src # ensure tests run against wheel - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - name: Run limited tests on PyPy env: PYTHON: ${{ matrix.python-version }} run: > uv run --only-group tox tox run --installpkg dist/*.whl -e $(echo $PYTHON | tr -d -)-tests coverage: name: Combine & check coverage runs-on: ubuntu-latest needs: tests steps: - name: Download pre-built packages uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: Packages path: dist - run: tar xf dist/*.tar.gz --strip-components=1 - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - name: Download coverage data uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: coverage-data-* merge-multiple: true - name: Combine coverage & fail if it's <100%. run: | uv tool install --python $(cat .python-version-default) coverage coverage combine coverage html --skip-covered --skip-empty # Report and write to summary. coverage report --format=markdown >> $GITHUB_STEP_SUMMARY # Report again and fail if under 100%. coverage report --fail-under=100 - name: Upload HTML report if check failed. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: html-report path: htmlcov if: ${{ failure() }} docs: name: Run doctests & render changelog runs-on: ubuntu-latest needs: build-package steps: - name: Download pre-built packages uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: Packages path: dist - run: tar xf dist/*.tar.gz --strip-components=1 - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - run: > uv run --only-group tox tox run -e docs-doctests,changelog lint: name: Run linters runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version-file: .python-version-default - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - run: > uv run --only-group tox tox run -f lint typing: name: Check types using supported type checkers runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version-file: .python-version-default - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - run: > uv run --only-group tox tox run -f typing install-dev: name: Verify dev env runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: hynek/setup-cached-uv@34e35d30f1ebc7421a5cc733bca38dcc62603960 # v2.6.0 - run: uv sync --python $(cat .python-version-default) - name: Ensure we can import attr and attrs packages run: | source .venv/bin/activate python -Ic 'import attr; print(attr.__version__)' python -Ic 'import attrs; print(attrs.__version__)' required-checks-pass: name: Ensure everything required is passing for branch protection if: always() needs: - coverage - tests-pypy - docs - install-dev - typing - lint runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 with: jobs: ${{ toJSON(needs) }}