test: Added a note to skip some tests in CI #7
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: | |
push: | |
branches: | |
- main | |
paths: | |
- "**/*.py" | |
- pyproject.toml | |
- poetry.lock | |
jobs: | |
test-and-release: | |
name: Test and Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
pip install poetry commitizen | |
poetry install | |
- name: Run tests | |
run: poetry run pytest -k 'not test_main_mapping_example_dir_relative and not test_main_mapping_example_dir' | |
- name: Check if version bump is needed | |
id: check | |
continue-on-error: true | |
run: | | |
cz bump --dry-run || exit 0 | |
echo "bump=$(cz bump --dry-run 2>&1 | grep -q 'bump:' && echo 'yes' || echo 'no')" >> $GITHUB_OUTPUT | |
- name: Set up Git user | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Bump version | |
if: steps.check.outputs.bump == 'yes' | |
id: bump | |
run: | | |
cz bump --yes | |
echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
- name: Build project | |
run: poetry build | |
- name: Generate Changelog | |
if: steps.check.outputs.bump == 'yes' | |
id: changelog | |
run: echo "changelog=$(cz changelog)" >> $GITHUB_OUTPUT | |
- name: Create Release | |
if: steps.check.outputs.bump == 'yes' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.bump.outputs.version }} | |
release_name: Release ${{ steps.bump.outputs.version }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
- name: Publish to PyPI | |
if: steps.check.outputs.bump == 'yes' | |
env: | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_PASSWORD | |
poetry publish | |
- name: Push changes | |
if: steps.check.outputs.bump == 'yes' | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |