Skip to content

chore(tests): refactor #103

chore(tests): refactor

chore(tests): refactor #103

---
# This workflow will install Python dependencies, run tests
# Depending on commit messages it will update version and push new commit
name: Test and Version
on:
push:
branches: [master]
tags-ignore: [v*]
pull_request:
branches: [master]
tags-ignore: [v*]
jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: isort/isort-action@v1
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[dev]"
- name: Check style with ruff
run: |
ruff check .
test:
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::826306421341:role/pycs-github-actions
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[test]"
- name: Test with pytest
run: |
pytest --cov pycs .
- name: Upload coverage reports to Codecov
if: ${{ matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
release:
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'Automatically generated by python-semantic-release') }}
runs-on: ubuntu-latest
needs: [check-style, test]
concurrency: release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Install dependencies
run: |
pip install --upgrade pip
pip install python-semantic-release
pip install -U requests
- name: Update version and push
run: |-
semantic-release version