Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
ci: modernize test an release pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Aug 2, 2023
1 parent 77ffe60 commit 1a73019
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 25 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ concurrency:
cancel-in-progress: true

env:
PYTHON_VERSION_DEFAULT: "3.9"
POETRY_VERSION: "1.1.15"
REPORTS_DIR: CI_reports

jobs:
coding-standards:
# disabled, unless there are proper rules and configs for flake8 and mypy
if: false
name: Linting & Coding Standards
runs-on: ubuntu-latest
steps:
Expand All @@ -42,34 +46,33 @@ jobs:
uses: actions/checkout@v3
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.8
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install
run: poetry install --no-root
# - name: Run tox
# run: poetry run tox -e flake8

build-and-test:
name: Tests for Python ${{ matrix.python-version }} on ${{ matrix.os }}
name: Tests py${{ matrix.python-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
REPORTS_ARTIFACT: tests-reports
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- '3.11' # highest supported
- '3.10'
Expand All @@ -96,21 +99,17 @@ jobs:
run: mkdir ${{ env.REPORTS_DIR }}
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.1.8
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install
run: poetry install --no-root
- name: Ensure build successful
run: poetry build
# - name: Run tox
Expand Down
33 changes: 25 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ concurrency:
group: release
cancel-in-progress: false


env:
PYTHON_VERSION_DEFAULT: "3.9"
POETRY_VERSION: "1.1.15"

jobs:
release:
# https://github.51.almunity/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
Expand All @@ -37,18 +42,30 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4.7.0
- name: Setup python
# see https://github.com/actions/setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
architecture: 'x64'
- name: Install and configure Poetry
# See https://github.com/marketplace/actions/install-poetry-action
uses: snok/install-poetry@v1
with:
python-version: 3.9
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: |
python -m pip install poetry --upgrade pip
poetry config virtualenvs.create false
poetry install
run: poetry install --no-root
- name: View poetry version
run: poetry --version
- name: Python Semantic Release
uses: relekang/python-semantic-release@master
# see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
# see https://github.com/python-semantic-release/python-semantic-release
uses: python-semantic-release/python-semantic-release@v7.34.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}

0 comments on commit 1a73019

Please sign in to comment.