summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoris Roovers <joris.roovers@gmail.com>2023-06-22 12:06:10 +0200
committerGitHub <noreply@github.com>2023-06-22 12:06:10 +0200
commit0f5ed5cdde677137abe7a737b87c0face4b3cc4a (patch)
tree845472cc7da85546acdb988a92aa2ce5db65334c
parent84f9218251eba531dbc4e964a29a86401658d84f (diff)
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
-rw-r--r--.github/workflows/ci.yml127
1 files changed, 100 insertions, 27 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 31afc6e..b06c01f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true
jobs:
- checks:
+ tests:
runs-on: "ubuntu-latest"
strategy:
matrix:
@@ -32,9 +32,6 @@ 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.7.0
@@ -51,17 +48,14 @@ jobs:
run: hatch run test:type-check
- name: Install local gitlint for integration tests
- run: |
- hatch run qa:install-local
+ run: hatch run qa:install-local
- name: Integration tests
- run: |
- hatch run qa:integration-tests
+ run: hatch run qa:integration-tests
if: matrix.os != 'windows-latest'
- name: Integration tests (GITLINT_QA_USE_SH_LIB=0)
- run: |
- hatch run qa:integration-tests -k "not(test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit)" qa
+ run: hatch run qa:integration-tests -k "not(test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit)" qa
env:
GITLINT_QA_USE_SH_LIB: 0
if: matrix.os != 'windows-latest'
@@ -71,17 +65,6 @@ jobs:
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
if: matrix.os == 'windows-latest'
- - name: Build test (gitlint)
- run: |
- python -m build
- hatch clean
-
- - name: Build test (gitlint-core)
- run: |
- python -m build
- hatch clean
- working-directory: ./gitlint-core
-
# Run gitlint. Skip during PR runs, since PR commit messages are transient and usually full of gitlint violations.
# PRs get squashed and get a proper commit message during merge.
- name: gitlint --debug
@@ -97,7 +80,95 @@ jobs:
flag-name: gitlint-${{ matrix.os }}-${{ matrix.python-version }}
parallel: true
- doc_checks:
+ build-test:
+ runs-on: "ubuntu-latest"
+ strategy:
+ matrix:
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.9]
+ os: ["macos-latest", "ubuntu-latest", "windows-latest"]
+ steps:
+ - uses: actions/checkout@v3.3.0
+ with:
+ ref: ${{ github.event.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit
+ fetch-depth: 0 # checkout all history, needed for hatch versioning
+
+ - name: Install pypa/build
+ run: python -m pip install build==0.10.0
+
+ - name: Build test (gitlint)
+ run: python -m build
+
+ - name: Upload sdist tarball (gitlint)
+ uses: actions/upload-artifact@v3
+ with:
+ name: sdist-gitlint-${{ matrix.python-version }}
+ path: dist/*.tar.gz
+ if: matrix.os == 'ubuntu-latest'
+
+ - name: Build test (gitlint-core)
+ run: python -m build
+ working-directory: ./gitlint-core
+
+ - name: Upload sdist tarball (gitlint-core)
+ uses: actions/upload-artifact@v3
+ with:
+ name: sdist-gitlint-core-${{ matrix.python-version }}
+ path: ./gitlint-core/dist/*.tar.gz
+ if: matrix.os == 'ubuntu-latest'
+
+ sdist-build-smoke-test:
+ # Ensure we can re-build gitlint from its sdist tarball (and that gitlint works after that)
+ # This is important for downstream packages (e.g. debian, homebrew, etc)
+ needs: build-test
+ runs-on: "ubuntu-latest"
+ strategy:
+ matrix:
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", pypy-3.9]
+ steps:
+ - name: Setup python ${{ matrix.python-version }}
+ uses: actions/setup-python@v4.6.1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Download sdist artifact (gitlint)
+ uses: actions/download-artifact@v3
+ with:
+ name: sdist-gitlint-${{ matrix.python-version }}
+ path: gitlint
+
+ - name: Download sdist artifact (gitlint-core)
+ uses: actions/download-artifact@v3
+ with:
+ name: sdist-gitlint-core-${{ matrix.python-version }}
+ path: gitlint-core
+
+ - name: Extract sdist tarball (gitlint)
+ run: tar xzvf *.tar.gz --strip-components=1
+ working-directory: ./gitlint
+
+ - name: Extract sdist tarball (gitlint-core)
+ run: tar xzvf *.tar.gz --strip-components=1
+ working-directory: ./gitlint-core
+
+ - name: Install pypa/build
+ run: python -m pip install build==0.10.0
+
+ - name: Build test (gitlint)
+ run: python -m build
+ working-directory: ./gitlint
+
+ - name: Build test (gitlint-core)
+ run: python -m build
+ working-directory: ./gitlint-core
+
+ - name: Install from wheel (gitlint and gitlint-core)
+ run: python -m pip install gitlint-core/dist/*.whl gitlint/dist/*.whl
+
+ # Make sure gitlint works
+ - name: gitlint --version
+ run: gitlint --version
+
+ doc-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.3.0
@@ -115,8 +186,8 @@ jobs:
- name: Docs validation (mkdocs build & linkchecker)
run: hatch run docs:validate
- upload_coveralls:
- needs: checks
+ upload-coveralls:
+ needs: tests
runs-on: ubuntu-latest
steps:
- name: Upload coverage to coveralls
@@ -130,9 +201,11 @@ jobs:
if: always() # Ref: https://github.com/marketplace/actions/alls-green#why
needs:
- - checks
- - doc_checks
- - upload_coveralls
+ - tests
+ - build-test
+ - sdist-build-smoke-test
+ - doc-checks
+ - upload-coveralls
runs-on: ubuntu-latest