Release/0.1.11 (#23) #6
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: On pull request to main | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
jobs: | |
publish_to_pypi: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Wait until it appears under all pypi indexes | |
run: sleep 10 | |
create_github_release: | |
name: "Create github release" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Get release version | |
run: | | |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.VERSION }}" | |
release_name: Release v${{ env.VERSION }} | |
draft: false | |
prerelease: false | |
body: Release v${{ env.VERSION }} | |
test_pre_commit_from_main: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11" ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: Get release version | |
run: | | |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Change configs for tests | |
run: | | |
set -e | |
python tests/configs/change_repo.py | |
- name: Install pre commit | |
run: | | |
set -e | |
rm -r type_hint_checker | |
rm .pre-commit-hooks.yaml .pylintrc README.md setup.cfg setup.py | |
python -m pip install --upgrade pip | |
pip install pre-commit pytest | |
pre-commit install | |
pre-commit run --all-files || true # For pre-commit initialization | |
- name: Test with pytest | |
run: | | |
python -m pytest tests/test_pre_commit.py | |
test_command_line: | |
needs: publish_to_pypi | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11" ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get release version | |
run: | | |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
rm -r type_hint_checker | |
rm .pre-commit-config.yaml .pre-commit-hooks.yaml .pylintrc README.md setup.cfg setup.py | |
python -m pip install --upgrade pip | |
pip install pytest | |
pip install type-hint-checker==${{ env.VERSION }} | |
- name: Test with pytest | |
run: | | |
python -m pytest tests/test_command_line.py | |
test_from_pypi: | |
needs: publish_to_pypi | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11" ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- name: Get release version | |
run: | | |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Add type_hint_checker to PYTHONPATH | |
run: | | |
echo "PYTHONPATH=$PYTHONPATH:$PWD/type_hint_checker" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
rm -r type_hint_checker | |
rm .pre-commit-config.yaml .pre-commit-hooks.yaml .pylintrc README.md setup.cfg setup.py | |
python -m pip install --upgrade pip | |
pip install pytest | |
pip install type-hint-checker==${{ env.VERSION }} | |
- name: Test with pytest | |
run: | | |
pytest tests/test_unit_tests.py |