Skip to content

Commit 76be0eb

Browse files
committed
CI: build Linux on Docker/Alpine/musl for static binary
that is transferable and used by PyPI
1 parent c0fcc64 commit 76be0eb

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,17 @@ jobs:
109109
publish-pypi:
110110
name: Publish package to PYPI
111111
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') # only on tag/release
112-
needs: [build, build-debug, build-arm64-docker]
112+
needs: [build, build-debug, build-arm64-docker, build-amd64-docker-pipy]
113113
runs-on: ubuntu-18.04
114114
steps:
115115

116116
- uses: actions/checkout@master
117117

118118
- uses: actions/download-artifact@master
119119
with:
120-
name: dist-ubuntu-18.04
120+
# dist-ubuntu-18.04 is binary on Ubuntu+glibc (standard), dist-musl64 is on Alpine+musl (works with static library)
121+
#name: dist-ubuntu-18.04
122+
name: dist-musl64
121123
path: dist/
122124

123125
- uses: actions/download-artifact@master
@@ -235,3 +237,54 @@ jobs:
235237
name: "dist-arm64"
236238
path: ./dist
237239

240+
241+
build-amd64-docker-pipy:
242+
name: Build for PiPY on Docker/amd64 + MUSL libc
243+
#this build uses Alpine linux with MUSL stdlibc++ to allow working static lib (transferable everywhere)
244+
runs-on: ubuntu-18.04
245+
steps:
246+
- name: Install docker
247+
run: |
248+
# bug in ubuntu, conflicts with docker.io
249+
sudo apt-get update
250+
sudo apt-get remove --purge -y moby-engine moby-cli
251+
sudo apt-get install -y qemu-user-static docker.io
252+
253+
- uses: actions/checkout@v1
254+
255+
- name: x86/64 build
256+
run: |
257+
sudo docker build -t htm-amd64-docker --build-arg arch=amd64 .
258+
259+
- name: Tests
260+
run: |
261+
sudo docker run -it htm-amd64-docker /bin/sh
262+
uname -a && echo "\nHello from amd64 htm.core build!\n"
263+
python setup.py test
264+
exit
265+
266+
- name: Copy files from docker
267+
run: |
268+
sudo docker cp `sudo docker ps -alq`:/usr/local/src/htm.core/dist dist #TODO the `command` is not 100% reliable, replace with some name/id
269+
ls dist
270+
271+
- name: Release (deploy)
272+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') #only on tag/release, not schedule
273+
# from https://github.com/marketplace/actions/gh-release
274+
uses: softprops/action-gh-release@v1
275+
with:
276+
files: |
277+
dist/htm_core-v*gz
278+
env:
279+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280+
281+
- name: Pre-upload artifact
282+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
283+
run: rm dist/*.gz
284+
285+
- uses: actions/[email protected]
286+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
287+
with:
288+
name: "dist-musl64"
289+
path: ./dist
290+

0 commit comments

Comments
 (0)