-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (108 loc) · 4.36 KB
/
build-golang-ubuntu.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
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 }}