Skip to content

Commit

Permalink
feat: Add CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanCardin committed Sep 20, 2023
1 parent 0636e90 commit dc5bea6
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 13 deletions.
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: Github Release/Publish PyPi

on:
push:
tags:
- "v*.*.*"

jobs:
gh-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cappa
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.2.2
- name: Checkout
uses: actions/checkout@v1
- name: Build dist
run: poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test

on:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

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

- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.2.2

- name: Set up cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
run: poetry install -E rich

- name: Run Linters
run: poetry run make lint

- name: Run tests
run: poetry run make test

- name: Store test result artifacts
uses: actions/upload-artifact@v3
with:
path: coverage.xml

- name: Coveralls
env:
COVERALLS_FLAG_NAME: run-${{ inputs.working-directory }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
run: |
pip install tomli coveralls
coveralls --service=github
finish:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install tomli coveralls
coveralls --service=github --finish
26 changes: 15 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = [{include = "cappa", from = "src"}]
color = ["rich", "rich-argparse"]

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.8"
typing-extensions = "^4.7.1"
typing-inspect = "^0.9.0"
docstring-parser = "^0.15"
Expand Down
2 changes: 1 addition & 1 deletion src/cappa/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import typing
from dataclasses import dataclass

from typing_extensions import Callable, get_type_hints # type: ignore
from typing_extensions import Callable, get_type_hints

from cappa.command import Command, HasCommand
from cappa.typing import find_type_annotation
Expand Down

0 comments on commit dc5bea6

Please sign in to comment.