Skip to content

Commit

Permalink
Update CI configs, add 3.11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Oct 5, 2022
1 parent 74b19df commit e13bb71
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
max-parallel: 4
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11-dev"]

defaults:
run:
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v3

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

Expand Down Expand Up @@ -61,13 +61,25 @@ jobs:
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true' && matrix.os != 'MacOS'
run: timeout 10s poetry run pip --version || rm -rf .venv
if: steps.cache.outputs.cache-hit == 'true'
run: |
# `timeout` is not available on macOS, so we define a custom function.
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
# XXX: https://github.com/pypa/pip/issues/11352 causes random failures -- remove once fixed in a release.
- name: Upgrade pip on 3.11 for macOS
if: ${{ matrix.python-version == '3.11-dev' && matrix.os == 'macOS' }}
run: poetry run pip install git+https://github.com/pypa/pip.git@fbb7f0b293f1d9289d8c76a556540325b9a172b2

- name: Install dependencies
shell: bash
run: poetry install

- name: Run mypy
run: poetry run mypy

- name: Run pytest
shell: bash
run: poetry run pytest -v tests
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get tag
id: tag
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install dependencies
run: python -m pip install --upgrade pip poetry --pre
run: python -m pip install --upgrade pip poetry

- name: Build project
run: poetry build

- name: Publish release to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
poetry publish
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down

0 comments on commit e13bb71

Please sign in to comment.