Skip to content

Commit

Permalink
🧪🔧 Switch to using pypa/build in CI (#463)
Browse files Browse the repository at this point in the history
This patch switches the CI/CD workflows to use the PyPA-endorsed
PEP 517 build front-end called `build`. It is called without
`--sdist` and `--wheel` CLI options, in which case `build` creates
an sdist from the Git checkout but the following wheel build is made
from that sdist tarball as opposed to using the Git checkout.

This has a side effect of smoke-testing that it's possible to build
wheels from the published sdists. And this is the flow that
`pip install` follows when it's requested to install from an sdist.

Ref: #460 (comment)
  • Loading branch information
webknjaz committed Mar 10, 2023
1 parent 1f8a16b commit 61a69ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install pypa/build
run: python -m pip install build==0.10.0

- name: Install Hatch
run: python -m pip install hatch==1.6.3

Expand Down Expand Up @@ -74,12 +77,12 @@ jobs:

- name: Build test (gitlint)
run: |
hatch build
python -m build
hatch clean
- name: Build test (gitlint-core)
run: |
hatch build
python -m build
hatch clean
working-directory: ./gitlint-core

Expand Down Expand Up @@ -136,4 +139,4 @@ jobs:
secrets: inherit # pass all secrets (required to access secrets in a called workflow)
with:
pypi_target: "pypi.org"
repo_release_ref: "main"
repo_release_ref: "main"
7 changes: 5 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
with:
python-version: "3.11"

- name: Install pypa/build
run: python -m pip install build==0.10.0

- name: Install Hatch
run: python -m pip install hatch==1.6.3

Expand Down Expand Up @@ -76,13 +79,13 @@ jobs:
echo "gitlint_version=$(hatch version | cut -d+ -f1)" >> $GITHUB_OUTPUT
- name: Build (gitlint-core)
run: hatch build
run: python -m build
working-directory: ./gitlint-core
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.set_version.outputs.gitlint_version }}

- name: Build (gitlint)
run: hatch build
run: python -m build
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.set_version.outputs.gitlint_version }}

Expand Down

0 comments on commit 61a69ea

Please sign in to comment.