chore: add GitHub Actions workflow for publishing to PyPI and TestPyPI #231
Workflow file for this run
This file contains hidden or 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: Linting check | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v5 | |
| id: setup-python | |
| with: | |
| python-version: '3.9' | |
| - name: Setup poetry | |
| uses: abatilo/actions-poetry@v4 | |
| with: | |
| poetry-version: '2.1.4' | |
| - name: Setup a local virtual environment | |
| run: | | |
| poetry env use ${{ steps.setup-python.outputs.python-path }} | |
| poetry run python --version | |
| poetry config virtualenvs.create true --local | |
| poetry config virtualenvs.in-project true --local | |
| - uses: actions/cache@v4 | |
| name: Define a cache for the virtual environment based on the dependencies lock file | |
| id: cache | |
| with: | |
| path: ./.venv | |
| key: venv-${{ runner.os }}-3.9-${{ hashFiles('poetry.lock') }} | |
| - name: Ensure cache is healthy | |
| if: steps.cache.outputs.cache-hit == 'true' | |
| shell: bash | |
| run: poetry run pip --version >/dev/null 2>&1 || (echo "Cache is broken, skip it." && rm -rf .venv) | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Lint with flake8 | |
| run: poetry run flake8 |