Test (and Release) #1960
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
name: Test (and Release) | |
on: | |
merge_group: | |
types: [checks_requested] | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
create: | |
tags: | |
- "*" | |
jobs: | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Python check version | |
run: python --version | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v9 | |
- name: Release on pypi | |
run: poetry publish --build | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Python check version | |
run: python --version | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v9 | |
- name: Poetry check version | |
run: poetry --version | |
- name: Restore poetry cache | |
uses: actions/[email protected] | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | |
- name: Poetry install dependencies | |
run: poetry install | |
- name: Restore pre-commit cache | |
uses: actions/[email protected] | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run code quality tools | |
run: poetry run pre-commit run --all-files | |
- name: Run pytest | |
run: poetry run python -m pytest --cov=pytest_helm_charts/ --cov-report=xml --log-cli-level=info tests/ | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
env_vars: OS,PYTHON |