Skip to content

Commit

Permalink
Use pre-built packages in CI (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Aug 15, 2023
1 parent 42c71f1 commit 66f9b9b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
74 changes: 56 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,28 @@ on:

env:
FORCE_COLOR: "1" # Make tools pretty.
SETUPTOOLS_SCM_PRETEND_VERSION: "1.0" # avoid warnings about shallow checkout
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@v3
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v1

tests:
name: Tests & Mypy on ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: build-package
strategy:
matrix:
python-version:
Expand All @@ -36,7 +47,12 @@ jobs:
- "pypy-3.10"

steps:
- uses: actions/checkout@v3
- name: Download pre-built packages
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v4
with:
cache: pip
Expand All @@ -54,8 +70,13 @@ jobs:
python -Im pip install tox
python -Im tox run -f $V
- run: python -Im tox run -e mypy-api
python -Im tox run \
--installpkg dist/*.whl \
-f $V
- run: |
python -Im tox run \
--installpkg dist/*.whl \
-e mypy-api
if: ${{ !startsWith(matrix.python-version, 'pypy-') }}
- name: Upload coverage data
Expand All @@ -71,7 +92,12 @@ jobs:
needs: tests

steps:
- uses: actions/checkout@v3
- name: Download pre-built packages
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v4
with:
cache: pip
Expand All @@ -88,7 +114,7 @@ jobs:
python -Im coverage html --skip-covered --skip-empty
# Report and write to summary.
python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
# Report again and fail if under 100%.
python -Im coverage report --fail-under=100
Expand All @@ -103,47 +129,59 @@ jobs:
system-package:
name: Install & test with system package of Argon2.
runs-on: ubuntu-latest
env:
SETUPTOOLS_SCM_PRETEND_VERSION: "" # inconsistency error otherwise
needs: build-package

steps:
- uses: actions/checkout@v3
- name: Download pre-built packages
uses: actions/download-artifact@v3
with:
fetch-depth: 0
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v4
with:
cache: pip
python-version-file: .python-version-default

- name: Install dependencies & run tox
- name: Install dependencies
run: |
sudo apt-get install libargon2-0 libargon2-0-dev
python -VV
python -Im site
python -Im pip install --upgrade wheel tox
python -Im tox run -e system-argon2
- run: python -Im tox run -e system-argon2

mypy-pkg:
name: Type-check code base
runs-on: ubuntu-latest
needs: build-package
steps:
- uses: actions/checkout@v3
- name: Download pre-built packages
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v4
with:
cache: pip
python-version-file: .python-version-default
- run: python -Im pip install tox

- name: Prepare & run tox
run: |
python -Im pip install tox
python -Im tox run -e mypy-pkg
- run: python -Im tox run -e mypy-pkg

docs:
name: Build docs & run doctests
runs-on: ubuntu-latest
needs: build-package
steps:
- uses: actions/checkout@v3
- name: Download pre-built packages
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v4
with:
cache: pip
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pypi-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Build & maybe upload PyPI package

on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
release:
types:
- published
Expand All @@ -17,7 +14,6 @@ permissions:
id-token: write

jobs:
# Always build & lint package.
build-package:
name: Build & verify package
runs-on: ubuntu-latest
Expand All @@ -29,7 +25,6 @@ jobs:

- uses: hynek/build-and-inspect-python-package@v1

# Upload to Test PyPI on every commit on main.
release-test-pypi:
name: Publish in-dev package to test.pypi.org
environment: release-test-pypi
Expand Down

0 comments on commit 66f9b9b

Please sign in to comment.