Require setuptools #25
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: Python CI/CD Workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.13.0-rc.2 | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements-dev.txt | |
pre-commit install | |
- name: Lint Code | |
run: pre-commit run --all-files | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.13.0-rc.2 | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Run Tests | |
run: python -m unittest ntp_amplification_test.py | |
publish: | |
name: Check Version and Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.13.0-rc.2 | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
- name: Get Current Version | |
id: current_version | |
run: | | |
version=$(python -c "exec(open('version.py').read()); print(__version__)") | |
echo "Current version: $version" | |
echo "::set-output name=VERSION::$version" | |
- name: Check if Version is Incremented | |
id: version_check | |
run: | | |
git fetch origin master | |
git checkout master | |
cur_version=$(python -c "exec(open('version.py').read()); print(__version__)") | |
echo "Main branch version: $cur_version" | |
if [ "$cur_version" = "$version" ]; then | |
echo "Version has not been incremented, exiting..." | |
exit 1 | |
else | |
echo "Version is incremented, proceeding..." | |
fi | |
- name: Build Package | |
id: build | |
if: steps.version_check.outcome == 'success' | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
if: steps.build.outcome == 'success' | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
pip install twine | |
twine upload dist/* -u __token__ -p $PYPI_TOKEN |