Release/0.1.13 #21
Workflow file for this run
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: | |
pull_request: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
jobs: | |
publish_to_test_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 test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Wait until it appears under all pypi indexes | |
run: sleep 10 | |
test_pre_commit_from_branch: | |
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 | |
export rev=${{ github.head_ref }} | |
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 | |
sed "3s/main/release\\/${{ env.VERSION }}/" .pre-commit-config.yaml > tmp | |
mv tmp .pre-commit-config.yaml | |
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_test_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 -i https://test.pypi.org/simple/ type-hint-checker==${{ env.VERSION }} | |
- name: Test with pytest | |
run: | | |
python -m pytest tests/test_command_line.py | |
test_from_test_pypi: | |
needs: publish_to_test_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 -i https://test.pypi.org/simple/ type-hint-checker==${{ env.VERSION }} | |
- name: Test with pytest | |
run: | | |
pytest tests/test_unit_tests.py |