Skip to content

Commit a489bdf

Browse files
committed
Add GH workflows
1 parent 9a48cb4 commit a489bdf

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

.github/workflows/build_test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
19+
python-version: ['3.10', '3.11']
20+
env:
21+
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v3
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Python info
29+
shell: bash -l {0}
30+
run: |
31+
which python3
32+
python3 --version
33+
- name: Upgrade pip and install hatch
34+
run: |
35+
python3 -m pip install --upgrade pip hatch
36+
- name: Run unit tests
37+
run: hatch run test
38+
- name: Verify that we can build the package
39+
run: hatch build

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Linting build
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: "3.10"
23+
- name: Python info
24+
shell: bash -l {0}
25+
run: |
26+
which python3
27+
python3 --version
28+
- name: Upgrade pip and install hatch
29+
run: python3 -m pip install --upgrade pip hatch
30+
- name: Check style against standards
31+
run: hatch run

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.10'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)