Skip to content

Commit 0f5ed5c

Browse files
authored
GHA: Smoke test sdist package for downstream packaging (#509)
Smoke test sdist tarballs (gitlint and gitlint-core) for downstream packaging: - Upload and re-downloading them in a separate job - Extract the tarballs and rebuild wheels using pypa/build - Install the wheels - Run gitlint to ensure everything its not failing Closes #468
1 parent 84f9218 commit 0f5ed5c

File tree

1 file changed

+100
-27
lines changed

1 file changed

+100
-27
lines changed

.github/workflows/ci.yml

Lines changed: 100 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
checks:
18+
tests:
1919
runs-on: "ubuntu-latest"
2020
strategy:
2121
matrix:
@@ -32,9 +32,6 @@ jobs:
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434

35-
- name: Install pypa/build
36-
run: python -m pip install build==0.10.0
37-
3835
- name: Install Hatch
3936
run: python -m pip install hatch==1.7.0
4037

@@ -51,17 +48,14 @@ jobs:
5148
run: hatch run test:type-check
5249

5350
- name: Install local gitlint for integration tests
54-
run: |
55-
hatch run qa:install-local
51+
run: hatch run qa:install-local
5652

5753
- name: Integration tests
58-
run: |
59-
hatch run qa:integration-tests
54+
run: hatch run qa:integration-tests
6055
if: matrix.os != 'windows-latest'
6156

6257
- name: Integration tests (GITLINT_QA_USE_SH_LIB=0)
63-
run: |
64-
hatch run qa:integration-tests -k "not(test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit)" qa
58+
run: hatch run qa:integration-tests -k "not(test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit)" qa
6559
env:
6660
GITLINT_QA_USE_SH_LIB: 0
6761
if: matrix.os != 'windows-latest'
@@ -71,17 +65,6 @@ jobs:
7165
hatch run qa:integration-tests -k "not (test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit or test_lint_staged_stdin or test_stdin_file or test_stdin_pipe_empty)" qa
7266
if: matrix.os == 'windows-latest'
7367

74-
- name: Build test (gitlint)
75-
run: |
76-
python -m build
77-
hatch clean
78-
79-
- name: Build test (gitlint-core)
80-
run: |
81-
python -m build
82-
hatch clean
83-
working-directory: ./gitlint-core
84-
8568
# Run gitlint. Skip during PR runs, since PR commit messages are transient and usually full of gitlint violations.
8669
# PRs get squashed and get a proper commit message during merge.
8770
- name: gitlint --debug
@@ -97,7 +80,95 @@ jobs:
9780
flag-name: gitlint-${{ matrix.os }}-${{ matrix.python-version }}
9881
parallel: true
9982

100-
doc_checks:
83+
build-test:
84+
runs-on: "ubuntu-latest"
85+
strategy:
86+
matrix:
87+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.9]
88+
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
89+
steps:
90+
- uses: actions/[email protected]
91+
with:
92+
ref: ${{ github.event.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit
93+
fetch-depth: 0 # checkout all history, needed for hatch versioning
94+
95+
- name: Install pypa/build
96+
run: python -m pip install build==0.10.0
97+
98+
- name: Build test (gitlint)
99+
run: python -m build
100+
101+
- name: Upload sdist tarball (gitlint)
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: sdist-gitlint-${{ matrix.python-version }}
105+
path: dist/*.tar.gz
106+
if: matrix.os == 'ubuntu-latest'
107+
108+
- name: Build test (gitlint-core)
109+
run: python -m build
110+
working-directory: ./gitlint-core
111+
112+
- name: Upload sdist tarball (gitlint-core)
113+
uses: actions/upload-artifact@v3
114+
with:
115+
name: sdist-gitlint-core-${{ matrix.python-version }}
116+
path: ./gitlint-core/dist/*.tar.gz
117+
if: matrix.os == 'ubuntu-latest'
118+
119+
sdist-build-smoke-test:
120+
# Ensure we can re-build gitlint from its sdist tarball (and that gitlint works after that)
121+
# This is important for downstream packages (e.g. debian, homebrew, etc)
122+
needs: build-test
123+
runs-on: "ubuntu-latest"
124+
strategy:
125+
matrix:
126+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.9]
127+
steps:
128+
- name: Setup python ${{ matrix.python-version }}
129+
uses: actions/[email protected]
130+
with:
131+
python-version: ${{ matrix.python-version }}
132+
133+
- name: Download sdist artifact (gitlint)
134+
uses: actions/download-artifact@v3
135+
with:
136+
name: sdist-gitlint-${{ matrix.python-version }}
137+
path: gitlint
138+
139+
- name: Download sdist artifact (gitlint-core)
140+
uses: actions/download-artifact@v3
141+
with:
142+
name: sdist-gitlint-core-${{ matrix.python-version }}
143+
path: gitlint-core
144+
145+
- name: Extract sdist tarball (gitlint)
146+
run: tar xzvf *.tar.gz --strip-components=1
147+
working-directory: ./gitlint
148+
149+
- name: Extract sdist tarball (gitlint-core)
150+
run: tar xzvf *.tar.gz --strip-components=1
151+
working-directory: ./gitlint-core
152+
153+
- name: Install pypa/build
154+
run: python -m pip install build==0.10.0
155+
156+
- name: Build test (gitlint)
157+
run: python -m build
158+
working-directory: ./gitlint
159+
160+
- name: Build test (gitlint-core)
161+
run: python -m build
162+
working-directory: ./gitlint-core
163+
164+
- name: Install from wheel (gitlint and gitlint-core)
165+
run: python -m pip install gitlint-core/dist/*.whl gitlint/dist/*.whl
166+
167+
# Make sure gitlint works
168+
- name: gitlint --version
169+
run: gitlint --version
170+
171+
doc-checks:
101172
runs-on: ubuntu-latest
102173
steps:
103174
- uses: actions/[email protected]
@@ -115,8 +186,8 @@ jobs:
115186
- name: Docs validation (mkdocs build & linkchecker)
116187
run: hatch run docs:validate
117188

118-
upload_coveralls:
119-
needs: checks
189+
upload-coveralls:
190+
needs: tests
120191
runs-on: ubuntu-latest
121192
steps:
122193
- name: Upload coverage to coveralls
@@ -130,9 +201,11 @@ jobs:
130201
if: always() # Ref: https://github.com/marketplace/actions/alls-green#why
131202

132203
needs:
133-
- checks
134-
- doc_checks
135-
- upload_coveralls
204+
- tests
205+
- build-test
206+
- sdist-build-smoke-test
207+
- doc-checks
208+
- upload-coveralls
136209

137210
runs-on: ubuntu-latest
138211

0 commit comments

Comments
 (0)