[pre-commit.ci] pre-commit autoupdate #48
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: CI | |
on: | |
pull_request: | |
push: | |
branches: ["master", "main"] | |
paths-ignore: ["docs/**"] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/checkout@v3 | |
- name: Install Requirements | |
run: pip install -r requirements-dev.txt | |
- name: Run Pre-Commit | |
run: pre-commit run --all-files | |
pytest: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/checkout@v3 | |
- name: Install Requirements | |
run: pip install -r requirements-dev.txt | |
# This is needed to test the CLI entrypoint | |
- name: Install zet-cli | |
run: python3 -m pip install -e . | |
# This is needed to test the git commands | |
- name: Git config for tests | |
run: | | |
git config --global user.name "test" | |
git config --global user.email "test@zet-cli.test" | |
- name: Run tests | |
run: ZET_STAGE=test pytest -vv -s | |
setup-py-changes: | |
name: Check setup.py changes (new version) | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
outputs: | |
setup_changes: ${{ steps.filter.outputs.setup }} | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/checkout@v3 | |
- name: Filter paths | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
setup: | |
- 'setup.py' | |
- name: Setup changed | |
if: steps.filter.outputs.setup == 'true' | |
run: echo "Setup.py changed, need to republish distributions" | |
- name: Setup didn't change | |
if: steps.filter.outputs.setup != 'true' | |
run: echo "Setup.py didn't change, no distribution publishing" | |
build-and-publish: | |
name: TestPyPI - Build and publish Python distributions | |
runs-on: ubuntu-latest | |
needs: [pytest, setup-py-changes] | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/checkout@v3 | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
# # check if we need to distribute | |
if: | | |
needs.setup-py-changes.outputs.setup_changes == 'true' | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |