Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions #48

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: replace travis with github actions
bretello committed Oct 29, 2023
commit 5f525e7989be8af69bf20eca9d4768c9f708a419
50 changes: 50 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: lint

on:
push:
branches:
- "master"
- "release-*"
pull_request:
branches:
- "master"
- "release-*"
workflow_dispatch:

jobs:
tests:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
pyv: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.pyv }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyv }}

- name: set PY_CACHE_KEY
run: echo "PY_CACHE_KEY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- name: Cache .tox
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.tox/checkqa
key: "tox-lint|${{ matrix.os }}|${{ env.PY_CACHE_KEY }}|${{ hashFiles('tox.ini', 'setup.*') }}"

- name: Update pip/setuptools
run: |
pip install -U pip setuptools
- name: Install tox
run: python -m pip install tox

- name: Version information
run: python -m pip list

- name: Lint
run: tox -v -e checkqa
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish package to PyPI

on:
release:
types:
- published
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install requirements
run: |
pip install -U pip twine build
- name: Build
run: python -m build
- run: check-manifest
- run: twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*
85 changes: 85 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Tests

on:
push:
branches:
- "master"
- "release-*"
pull_request:
branches:
- "master"
- "release-*"
workflow_dispatch:

env:
PYTEST_ADDOPTS: "-vv --cov-report=xml:coverage-ci.xml"
PIP_DISABLE_PIP_VERSION_CHECK: true

defaults:
run:
shell: bash

jobs:
tests:
name: Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 5

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
python: ["3.8"]
tox_env: ["coverage"]
include:
- tox_env: "py39-coverage"
os: ubuntu-20.04
python: "3.9"
- tox_env: "py310-coverage"
python: "3.10"
os: ubuntu-20.04
- tox_env: "py311-coverage"
python: "3.11"
os: ubuntu-20.04

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: set PY_CACHE_KEY
run: echo "PY_CACHE_KEY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- name: Cache .tox
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.tox/${{ matrix.tox_env }}
key: "tox|${{ matrix.os }}|${{ matrix.tox_env }}|${{ env.PY_CACHE_KEY }}|${{ hashFiles('tox.ini', 'setup.*') }}"

- name: Update tools and print info
run: |
pip install -U pip setuptools virtualenv
pip list
- name: Install tox
run: pip install tox

- name: Setup tox environment
id: setup_tox
run: tox --notest -v -e ${{ matrix.tox_env }}

- name: Run tests
run: |
python -m tox -v -e ${{ matrix.tox_env }}
- name: Report coverage
if: always() && (contains(matrix.tox_env, 'coverage') && (steps.setup_tox.outcome == 'success'))
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage-ci.xml
flags: ${{ runner.os }}
name: ${{ matrix.tox_env }}
fail_ci_if_error: true
89 changes: 0 additions & 89 deletions .travis.yml

This file was deleted.