Skip to content

Commit

Permalink
CI: build Linux on Docker/Alpine/musl for static binary
Browse files Browse the repository at this point in the history
that is transferable and used by PyPI
  • Loading branch information
breznak committed Oct 30, 2019
1 parent c0fcc64 commit 76be0eb
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ jobs:
publish-pypi:
name: Publish package to PYPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') # only on tag/release
needs: [build, build-debug, build-arm64-docker]
needs: [build, build-debug, build-arm64-docker, build-amd64-docker-pipy]
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@master

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

- uses: actions/download-artifact@master
Expand Down Expand Up @@ -235,3 +237,54 @@ jobs:
name: "dist-arm64"
path: ./dist


build-amd64-docker-pipy:
name: Build for PiPY on Docker/amd64 + MUSL libc
#this build uses Alpine linux with MUSL stdlibc++ to allow working static lib (transferable everywhere)
runs-on: ubuntu-18.04
steps:
- name: Install docker
run: |
# bug in ubuntu, conflicts with docker.io
sudo apt-get update
sudo apt-get remove --purge -y moby-engine moby-cli
sudo apt-get install -y qemu-user-static docker.io
- uses: actions/checkout@v1

- name: x86/64 build
run: |
sudo docker build -t htm-amd64-docker --build-arg arch=amd64 .
- name: Tests
run: |
sudo docker run -it htm-amd64-docker /bin/sh
uname -a && echo "\nHello from amd64 htm.core build!\n"
python setup.py test
exit
- name: Copy files from docker
run: |
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
ls dist
- name: Release (deploy)
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') #only on tag/release, not schedule
# from https://github.com/marketplace/actions/gh-release
uses: softprops/action-gh-release@v1
with:
files: |
dist/htm_core-v*gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Pre-upload artifact
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: rm dist/*.gz

- uses: actions/upload-artifact@v1.0.0
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
with:
name: "dist-musl64"
path: ./dist

0 comments on commit 76be0eb

Please sign in to comment.