-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from tjquillan/ci
Add CI configurations
- Loading branch information
Showing
4 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: {} | ||
|
||
concurrency: | ||
group: tests-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} ${{ matrix.suffix }} | ||
runs-on: ${{ matrix.image }} | ||
strategy: | ||
matrix: | ||
os: [Ubuntu, macOS, Windows] | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
include: | ||
- os: Ubuntu | ||
image: ubuntu-latest | ||
- os: Windows | ||
image: windows-2022 | ||
- os: macOS | ||
image: macos-11 | ||
fail-fast: false | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Bootstrap poetry | ||
run: | | ||
curl -sL https://install.python-poetry.org | python3 - -y ${{ matrix.bootstrap-args }} | ||
- name: Update PATH | ||
if: ${{ matrix.os != 'Windows' }} | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Update PATH for Windows | ||
if: ${{ matrix.os == 'Windows' }} | ||
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH | ||
|
||
- name: Configure poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
id: python | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "poetry" | ||
|
||
- name: Install dependencies | ||
run: poetry install --with ci | ||
|
||
- name: Run mypy | ||
run: poetry run mypy | ||
|
||
- name: Run pytest | ||
run: poetry run pytest -p no:sugar -q tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }} | ||
- name: Update PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Build project for distribution | ||
run: poetry build | ||
|
||
- name: Check Version | ||
id: check-version | ||
run: | | ||
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ | ||
|| echo name=prerelease::true >> $GITHUB_OUTPUT | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "dist/*" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: steps.check-version.outputs.prerelease == 'true' | ||
|
||
- name: Publish to PyPI | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters