Skip to content

Commit 20921d9

Browse files
b-longb-long
authored andcommitted
Initial commit
0 parents  commit 20921d9

23 files changed

+2242
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
name: macOS -- Build Python wheel using golang's gopy
3+
4+
on:
5+
push:
6+
branches:
7+
- develop
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
call-lint:
15+
uses: ./.github/workflows/lint-on-macos.yaml
16+
17+
build:
18+
runs-on: macos-13
19+
permissions:
20+
contents: write
21+
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
go-version: [1.22.x]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
# - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew
31+
# uses: douglascamata/setup-docker-macos-action@v1-alpha
32+
33+
34+
# - name: Verify docker Installation
35+
# run: |
36+
# docker --version
37+
# docker ps
38+
39+
# - name: Setup vagrant
40+
# run: |
41+
# brew install vagrant
42+
# vagrant --version
43+
44+
- name: Setup Go
45+
uses: actions/setup-go@v4
46+
with:
47+
go-version: ${{ matrix.go-version }}
48+
cache-dependency-path: go.sum
49+
- name: Install dependencies
50+
run: go get .
51+
- name: Test with Go
52+
run: go test
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version: '3.11'
58+
59+
- name: Install dependencies
60+
run: |
61+
pip install poetry
62+
63+
# Look for go/bin (skip, we know it exists)
64+
echo '$HOME/'
65+
ls -la "$HOME/"
66+
67+
echo '$HOME/.local/'
68+
ls -la "$HOME/.local/"
69+
70+
echo '$HOME/go/'
71+
ls -la "$HOME/go/"
72+
73+
- name: Add Go bin directory to PATH
74+
run: echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV
75+
76+
# FIXME: Add more caching
77+
- name: Add gopy dependencies and build wheel
78+
run: |
79+
# Since we don't have our wheel build / install configured yet we use '--no-root'
80+
poetry install --no-root
81+
82+
source .venv/bin/activate
83+
84+
# Add Go bin directory to PATH
85+
echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV
86+
87+
go install golang.org/x/tools/cmd/goimports@latest
88+
89+
go install github.com/go-python/gopy@latest
90+
91+
poetry run pip install --upgrade setuptools wheel
92+
93+
gopy build --output=ohpygossh -vm=python3 .
94+
95+
poetry run python3 setup.py bdist_wheel
96+
97+
- name: Test Python wheel
98+
run: |
99+
# Test wheel installation
100+
pip install dist/otdf_python-0.0.1-py3-none-any.whl
101+
102+
# Test wheel functionality
103+
python3 validate_otdf_python.py
104+
105+
# release:
106+
# needs: build
107+
# runs-on: macos-latest
108+
# if: github.ref == 'refs/heads/main'
109+
# permissions:
110+
# contents: write
111+
# steps:
112+
# - uses: actions/checkout@v4
113+
114+
- name: Store version
115+
run: |
116+
pip install poetry
117+
118+
PROJECT_VESION=$(poetry version -s)
119+
echo "PROJECT_VESION=$PROJECT_VESION" >> $GITHUB_ENV
120+
121+
- name: Install twine
122+
run: pip install twine
123+
124+
- name: Upload to PyPI
125+
env:
126+
TWINE_UPLOAD_URL: https://test.pypi.org/legacy/
127+
PYPI_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }}
128+
PYPI_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
129+
run: |
130+
twine upload --password "$PYPI_PASSWORD" --user "$PYPI_USERNAME" --repository-url "$TWINE_UPLOAD_URL" dist/*
131+
132+
- uses: ncipollo/release-action@v1
133+
with:
134+
artifacts: |
135+
README.md,
136+
dist/*.whl
137+
body: OhPyGoSSH version ${{ env.PROJECT_VESION }}
138+
# tag: "dev-${{ github.job }}-${{ env.PROJECT_VESION }}"
139+
tag: v${{ env.PROJECT_VESION }}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
name: macOS -- Build Python wheel using golang's gopy
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
call-lint:
15+
uses: ./.github/workflows/lint-on-macos.yaml
16+
17+
build:
18+
runs-on: macos-13
19+
permissions:
20+
contents: write
21+
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
go-version: [1.22.x]
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
# - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew
31+
# uses: douglascamata/setup-docker-macos-action@v1-alpha
32+
33+
34+
# - name: Verify docker Installation
35+
# run: |
36+
# docker --version
37+
# docker ps
38+
39+
# - name: Setup vagrant
40+
# run: |
41+
# brew install vagrant
42+
# vagrant --version
43+
44+
- name: Setup Go
45+
uses: actions/setup-go@v4
46+
with:
47+
go-version: ${{ matrix.go-version }}
48+
cache-dependency-path: go.sum
49+
- name: Install dependencies
50+
run: go get .
51+
- name: Test with Go
52+
run: go test
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version: '3.11'
58+
59+
- name: Install dependencies
60+
run: |
61+
pip install poetry
62+
63+
# Look for go/bin (skip, we know it exists)
64+
echo '$HOME/'
65+
ls -la "$HOME/"
66+
67+
echo '$HOME/.local/'
68+
ls -la "$HOME/.local/"
69+
70+
echo '$HOME/go/'
71+
ls -la "$HOME/go/"
72+
73+
- name: Add Go bin directory to PATH
74+
run: echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV
75+
76+
# FIXME: Add more caching
77+
- name: Add gopy dependencies and build wheel
78+
run: |
79+
# Since we don't have our wheel build / install configured yet we use '--no-root'
80+
poetry install --no-root
81+
82+
source .venv/bin/activate
83+
84+
# Add Go bin directory to PATH
85+
echo "export PATH=$PATH:~/.local/go/bin" >> $GITHUB_ENV
86+
87+
go install golang.org/x/tools/cmd/goimports@latest
88+
89+
go install github.com/go-python/gopy@latest
90+
91+
poetry run pip install --upgrade setuptools wheel
92+
93+
gopy build --output=ohpygossh -vm=python3 .
94+
95+
poetry run python3 setup.py bdist_wheel
96+
97+
- name: Test Python wheel
98+
run: |
99+
# Test wheel installation
100+
pip install dist/otdf_python-0.0.1-py3-none-any.whl
101+
102+
# Test wheel functionality
103+
python3 validate_otdf_python.py
104+
105+
# release:
106+
# needs: build
107+
# runs-on: macos-latest
108+
# if: github.ref == 'refs/heads/main'
109+
# permissions:
110+
# contents: write
111+
# steps:
112+
# - uses: actions/checkout@v4
113+
114+
- name: Store version
115+
run: |
116+
pip install poetry
117+
118+
PROJECT_VESION=$(poetry version -s)
119+
echo "PROJECT_VESION=$PROJECT_VESION" >> $GITHUB_ENV
120+
121+
- name: Install twine
122+
run: pip install twine
123+
124+
- name: Upload to PyPI
125+
env:
126+
TWINE_UPLOAD_URL: https://upload.pypi.org/legacy/
127+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
128+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
129+
run: |
130+
twine upload --password "$PYPI_PASSWORD" --user "$PYPI_USERNAME" --repository-url "$TWINE_UPLOAD_URL" dist/*
131+
132+
- uses: ncipollo/release-action@v1
133+
with:
134+
artifacts: |
135+
README.md,
136+
dist/*.whl
137+
body: OhPyGoSSH version ${{ env.PROJECT_VESION }}
138+
# tag: "dev-${{ github.job }}-${{ env.PROJECT_VESION }}"
139+
tag: v${{ env.PROJECT_VESION }}

0 commit comments

Comments
 (0)