Bump version 0.0.7 -> 0.0.8 #11
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: Multiplatform -- Build Python wheel using golang's gopy | |
# Based on https://github.com/tuananh/py-event-ruler/blob/0129d15e17d0023863a4d0e0e25e5256988b5c5b/.github/workflows/publish.yml | |
on: | |
push: | |
branches: | |
- develop | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
call-lint: | |
uses: ./.github/workflows/lint-on-macos.yaml | |
build_macos: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: true | |
matrix: | |
os_version: [ 13 ] | |
go-version: [ 1.22.x ] | |
python3_version: [ 11 ] | |
# go-version: [ '1.19', '1.20', '1.22.x' ] | |
runs-on: macos-${{ matrix.os_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew | |
uses: douglascamata/setup-docker-macos-action@v1-alpha | |
- name: Verify docker Installation | |
run: | | |
docker --version | |
docker ps | |
- name: Setup vagrant | |
run: | | |
brew install vagrant | |
vagrant --version | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: go.sum | |
- name: Install dependencies | |
run: go get . | |
- name: Test with Go | |
run: go test | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
# Look for go/bin (skip, we know it exists) | |
echo '$HOME/' | |
ls -la "$HOME/" | |
echo '$HOME/go/' | |
ls -la "$HOME/go/" | |
- name: Add Go bin directory to PATH | |
run: echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV | |
# FIXME: Add more caching | |
- name: Add gopy dependencies and build wheel | |
run: | | |
# Since we don't have our wheel build / install configured yet we use '--no-root' | |
poetry install --no-root | |
source .venv/bin/activate | |
# Add Go bin directory to PATH | |
echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install github.com/go-python/gopy@latest | |
poetry run pip install --upgrade setuptools wheel | |
gopy build --output=ohpygossh -vm=python3 . | |
poetry run python3 setup.py bdist_wheel | |
- name: Test Python wheel | |
run: | | |
# Test wheel installation | |
pip install dist/ohpygossh-0.0.8-py3-none-any.whl | |
# Test wheel functionality | |
python3 validate_ohpygossh.py | |
# Name properly | |
mv dist/ohpygossh-0.0.8-py3-none-any.whl dist/ohpygossh-0.0.8-none-any-macosx_11_0_x86_64.whl | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
# name: wheels-macos${{ matrix.os_version }}-py3${{ matrix.python3_version }}-${{ matrix.arch_cibw_go[0] }} | |
name: wheels-macos${{ matrix.os_version }}-py3${{ matrix.python3_version }}-x86_64 | |
path: ./dist/*.whl | |
build_linux_x86_64: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: true | |
matrix: | |
go-version: [1.22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Vagrant | |
run: sudo apt-get update && sudo apt-get install -y vagrant | |
- name: Verify docker and vagrant installation | |
run: | | |
docker --version | |
docker ps | |
vagrant --version | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: go.sum | |
- name: Install dependencies | |
run: go get . | |
- name: Test with Go | |
run: go test | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
# Look for go/bin (skip, we know it exists) | |
echo '$HOME/' | |
ls -la "$HOME/" | |
echo '$HOME/go/' | |
ls -la "$HOME/go/" | |
- name: Add Go bin directory to PATH | |
run: echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV | |
# FIXME: Add more caching | |
- name: Add gopy dependencies and build wheel | |
run: | | |
# Since we don't have our wheel build / install configured yet we use '--no-root' | |
poetry install --no-root | |
source .venv/bin/activate | |
# Add Go bin directory to PATH | |
echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install github.com/go-python/gopy@latest | |
poetry run pip install --upgrade setuptools wheel | |
gopy build --output=ohpygossh -vm=python3 . | |
poetry run python3 setup.py bdist_wheel | |
- name: Test Python wheel | |
run: | | |
# Test wheel installation | |
pip install dist/ohpygossh-0.0.8-py3-none-any.whl | |
# Test wheel functionality | |
python3 validate_ohpygossh.py | |
# Name properly | |
mv dist/ohpygossh-0.0.8-py3-none-any.whl dist/ohpygossh-0.0.8-none-any-manylinux2014_x86_64.whl | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-amd64 | |
path: ./dist/*.whl | |
release: | |
permissions: | |
contents: write | |
needs: [build_macos, build_linux_x86_64] | |
runs-on: ubuntu-latest | |
# if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Collect all wheels | |
run: | | |
# ls -R | |
mkdir dist | |
for f in $(find . -type f -name '*.whl'); do mv ${f} dist; done; | |
ls -R dist | |
- name: Store version | |
run: | | |
pip install poetry | |
PROJECT_VESION=$(poetry version -s) | |
echo "PROJECT_VESION=$PROJECT_VESION" >> $GITHUB_ENV | |
- name: Install twine | |
run: pip install twine | |
- name: Upload to PyPI | |
env: | |
TWINE_UPLOAD_URL: https://test.pypi.org/legacy/ | |
PYPI_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} | |
run: | | |
twine upload --password "$PYPI_PASSWORD" --user "$PYPI_USERNAME" --repository-url "$TWINE_UPLOAD_URL" dist/* | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: | | |
README.md, | |
dist/*.whl | |
body: OhPyGoSSH version ${{ env.PROJECT_VESION }} | |
# tag: "dev-${{ github.job }}-${{ env.PROJECT_VESION }}" | |
tag: v${{ env.PROJECT_VESION }} |