Skip to content

Commit

Permalink
Add workflows for tests and release
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane committed Nov 30, 2024
1 parent c151cc4 commit 747532d
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/arch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pytest-arch
run-name: Run pytest on Arch Linux
on:
push:
branches: 'main'
pull_request:
jobs:
pytest:
runs-on: archlinux:latest
strategy:
matrix:
python-version: ["3.9", "3.13"]
name: pytest-arch-python-${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip3 install .[tests]
- name: Run pytest
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
python3 -m pytest -v -n auto
39 changes: 39 additions & 0 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: pytest-macos
run-name: Run pytest on macOS
on:
push:
branches: 'main'
pull_request:

jobs:
pytest:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.9", "3.13"]
name: pytest-macos-python-${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install Homebrew dependencies
run: |
rm -f /usr/local/bin/2to3* /usr/local/bin/python3* /usr/local/bin/idle3* \
/usr/local/bin/pydoc3* # Homebrew will fail if these exist
brew install virtualenv
- name: Install Python dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install .[tests]
- name: Run pytest
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
source .venv/bin/activate
pytest -v -n auto
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish
run-name: Publish to PyPi
on:
release:
types: [published]

permissions:
contents: write

jobs:
build-and-publish:
name: Build and publish to PyPi
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install build
run: |
python3 -m pip install build
python3 -m pip install setuptools --upgrade
- name: Build
run: |
python3 -m build --sdist --wheel --outdir dist/ .
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} dist/*
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pytest-ubuntu
run-name: Run pytest on Ubuntu
on:
push:
branches: 'main'
pull_request:
jobs:
pytest:
runs-on: ubuntu:latest
strategy:
matrix:
python-version: ["3.9", "3.13"]
name: pytest-ubuntu-python-${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip3 install .[tests]
- name: Run pytest
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
python3 -m pytest -v -n auto
Empty file removed tests/.gitkeep
Empty file.

0 comments on commit 747532d

Please sign in to comment.