Skip to content

Commit

Permalink
Add workflow for building and checking package metadata (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam committed Feb 14, 2022
1 parent 05a0dbb commit 459cad5
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/python-test-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
workflow_call:
inputs:
requirements_file:
type: "string"
required: false
default: "setup.cfg"

jobs:
build-and-check:
name: Build and check package metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles(inputs.requirements_file) }}
restore-keys: ${{ runner.os }}-pip
- name: Install dependencies
run: python3 -m pip install --upgrade build twine
- name: Build
run: python3 -m build --sdist --wheel .
- name: Check package metadata
run: twine check --strict dist/*
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,24 @@ jobs:
with:
python-version: "3.10"
```

### `python-test-build`

A reusable workflow for verifying Python package metadata.

#### Example usage

```yaml
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
check-build:
name: Check packaging
uses: less-action/reusables/.github/workflows/python-test-build.yaml@v2
```

0 comments on commit 459cad5

Please sign in to comment.