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: Ubuntu -- Build Python wheel using golang's gopy | |
on: [push] | |
jobs: | |
call-lint: | |
uses: ./.github/workflows/lint-on-ubuntu.yaml | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: true | |
matrix: | |
go-version: [1.22.x] | |
# go-version: [ '1.19', '1.20', '1.22.x' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- 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/.local/' | |
ls -la "$HOME/.local/" | |
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 | |
# TODO: Can this be a distinct job? | |
# exercise-ssh: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
- name: Check existing workspace content | |
run: | | |
ls -la | |
ls -la dist/ | |
- 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: Create Vagrantfile | |
run: | | |
cat << EOF > Vagrantfile | |
Vagrant.configure("2") do |config| | |
config.vm.provider "docker" do |d| | |
d.image = "ubuntu" | |
d.cmd = [ "/bin/bash", "-c", "echo 'Hello world'" ] | |
d.remains_running = false | |
end | |
end | |
EOF | |
- name: Run vagrant up | |
run: vagrant up --provider=docker | |
- name: Launch the Docker/Vagrant test machine | |
run: | | |
# Change directory | |
cd ssh-servers/docker-in-vagrant | |
# List content in the directory | |
ls -la | |
# Launch machine | |
vagrant up --provider=docker | |
# Connect to it with SSH | |
vagrant ssh -c "echo 'Hello Ubuntu'" | |
- name: Test Python wheel | |
run: | | |
# Test wheel installation | |
pip install dist/ohpygossh-0.0.7-py3-none-any.whl | |
# DISABLED: Need to figure out Ubuntu nested VM | |
# Test wheel functionality | |
# python3 validate_ohpygossh.py | |
# DISABLED: Only release from macOS build | |
# - uses: ncipollo/release-action@v1 | |
# with: | |
# artifacts: | | |
# README.md, | |
# dist/*.whl | |
# body: OhPyGoSSH version ${{ github.sha }} | |
# # tag: "dev-${{ github.job }}-${{ github.sha }}" | |
# tag: dev-${{ github.run_number }} |