Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get ready for releases #51

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 101 additions & 49 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,36 @@ name: Build wheels

on:
pull_request:
release:
types: [created, edited]
push:
tags:
- "v*"

jobs:
# Build the source distribution for PyPI
build_sdist:
name: Build sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Build sdist
run: |
python3.10 -m pip install --upgrade wheel
python3.10 setup.py sdist

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

# Build binary distributions for PyPI
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -28,54 +54,80 @@ jobs:
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1.2.0

- name: Build sdist
if: runner.os == 'Linux'
run: |
python setup.py sdist

- name: Build Linux wheels
if: runner.os == 'Linux'
uses: pypa/cibuildwheel@v2.4.0
env:
CIBW_BEFORE_ALL: 'sh ./scripts/install-go.sh'
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-*
CIBW_SKIP: "*-musllinux_*"
CIBW_ARCHS: x86_64 i686 aarch64

- name: Build macOS wheels
if: runner.os == 'macOS'
- name: Build wheels
uses: pypa/cibuildwheel@v2.4.0
env:
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-*
CIBW_ARCHS: x86_64 universal2

- name: Build Windows wheels
if: runner.os == 'Windows'
uses: pypa/cibuildwheel@v2.4.0
env:
CIBW_BUILD: cp38-* cp39-* cp310-*
CIBW_SKIP: cp37-*

- uses: actions/upload-artifact@v2
with:
path: |
./wheelhouse/*.whl
./dist/*.tar.gz

# - name: Publish sdist
# if: runner.os == 'Linux'
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: |
# twine check ./dist/*.tar.gz
# twine upload --skip-existing ./dist/*


# - name: Publish wheels
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# run: |
# twine check ./wheelhouse/*.whl
# twine upload --skip-existing ./wheelhouse/*
path: wheelhouse/starlark_go-*.whl

# Create a GitHub release
github_release:
name: Create GitHub release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: "✏️ Generate release changelog"
id: changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
filterByMilestone: false
onlyLastTag: true
pullRequests: true
prWoLabels: true
token: ${{ secrets.GITHUB_TOKEN }}
verbose: true

- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
files: dist/**/*

# Test PyPI
test_pypi_publish:
name: Test publishing to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

# Publish to PyPI
pypi_publish:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/bumpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Bump version
on:
push:
branches:
- main
pull_request:
types:
- labeled

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- uses: haya14busa/action-bumpr@v1
2 changes: 1 addition & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Valgrind

on:
pull_request:
workflow_dispatch:

jobs:
build:
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,15 @@ profile = "black"
lines_between_types = 1

[tool.cibuildwheel]
build = "cp37-* cp38-* cp39-* cp310-*"
skip = "*-musllinux_*"
test-requires = "pytest"
test-command = "pytest {project}/tests"

[tool.cibuildwheel.linux]
before-all = "sh ./scripts/install-go.sh"
archs = ["x86_64", "i686", "aarch64"]

[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2"]
test-skip = ["*_arm64", "*_universal2:arm64"]