release v1.0.0 #30
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install the package and the dependencies | |
run: pip install -e ".[dev]" | |
- name: Run tests with pytest | |
run: pytest | |
- name: Check that the version matches the tag | |
if: github.event_name == 'push' && github.ref_type == 'tag' && runner.os != 'Windows' | |
run: | | |
python3 -c "import astyle_py, sys; sys.exit(0 if f\"v{astyle_py.__version__}\" == \"${{ github.ref_name }}\" else 1)" | |
build_wheels: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- run: python3 -m pip install --upgrade setuptools build | |
- run: | | |
python3 -m build | |
find dist | |
- name: Upload wheels as job artifacts | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: dist | |
path: dist | |
- name: Sanity-check the resulting wheel | |
run: | | |
python3 -m venv venv | |
. venv/bin/activate | |
pip install dist/*.whl | |
astyle_py --version | |
upload_wheels: | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Download wheels from artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
repository_url: ${{ secrets.PYPI_URL }} |