Skip to content

Commit

Permalink
Use docker buildx in release (linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Nov 14, 2023
1 parent 9dbd2a2 commit 61eae90
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 130 deletions.
167 changes: 80 additions & 87 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,92 @@ jobs:
draft: false
prerelease: false
build_linux:
name: "linux build: ${{ matrix.arch }}"
runs-on: ubuntu-20.04 # use older version on purpose for GLIBC
name: "linux build"
runs-on: ubuntu-latest
needs: create_release # we need to know the upload URL
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: build
run: |
docker buildx build . --platform linux/amd64,linux/arm64,linux/arm/v7 --output 'type=local,dest=dist'
- name: package
run: |
cd _install && \
tar -czf piper-phonemize_linux_${{ matrix.arch }}.tar.gz piper-phonemize/
- name: upload-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: dist/piper-phonemize_amd64.tar.gz
asset_name: piper-phonemize_linux_x86_64.tar.gz
asset_content_type: application/octet-stream
- name: upload-arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: dist/piper-phonemize_arm64.tar.gz
asset_name: piper-phonemize_linux_aarch64.tar.gz
asset_content_type: application/octet-stream
- name: upload-armv7
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: dist/piper-phonemize_armv7.tar.gz
asset_name: piper-phonemize_linux_armv7l.tar.gz
asset_content_type: application/octet-stream
build_windows:
runs-on: windows-latest
name: "windows build: ${{ matrix.arch }}"
needs: create_release # we need to know the upload URL
strategy:
fail-fast: true
matrix:
arch: [x86_64, aarch64, armv7]
sys: [linux]
include:
- arch: x86_64
ccarch: x86_64
archproc: x86_64
- arch: aarch64
ccarch: aarch64
archproc: aarch64
- arch: armv7
ccarch: arm
archproc: armv7l
arch: [x64]
steps:
- uses: actions/checkout@v3
- name: build-deps
- name: configure
run: |
sudo apt-get update
sudo apt-get install g++-12-${{ matrix.ccarch }}-linux-gnu
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
- name: build
run: |
cmake --build build --config Release
- name: install
run: |
cmake --install build
- name: package
run: |
cd _install
Compress-Archive -LiteralPath piper-phonemize -DestinationPath piper-phonemize_windows_amd64.zip
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: _install/piper-phonemize_windows_amd64.zip
asset_name: piper-phonemize_windows_amd64.zip
asset_content_type: application/zip
build_macos:
runs-on: macos-latest
name: "mac build: ${{ matrix.arch }}"
needs: create_release # we need to know the upload URL
strategy:
fail-fast: true
matrix:
arch: [x64, aarch64]
steps:
- uses: actions/checkout@v3
- name: configure
run: |
export CC="${{ matrix.ccarch }}-${{ matrix.sys }}-gcc-12"
export CXX="${{ matrix.ccarch }}-${{ matrix.sys }}-g++-12"
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.archproc }}
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
- name: build
run: |
cmake --build build --config Release
Expand All @@ -62,77 +119,13 @@ jobs:
- name: package
run: |
cd _install && \
tar -czf piper-phonemize_linux_${{ matrix.arch }}.tar.gz piper-phonemize/
tar -czf piper-phonemize_macos_${{ matrix.arch }}.tar.gz piper-phonemize/
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: _install/piper-phonemize_linux_${{ matrix.arch }}.tar.gz
asset_name: piper-phonemize_linux_${{ matrix.arch }}.tar.gz
asset_path: _install/piper-phonemize_macos_${{ matrix.arch }}.tar.gz
asset_name: piper-phonemize_macos_${{ matrix.arch }}.tar.gz
asset_content_type: application/octet-stream
# build_windows:
# runs-on: windows-latest
# name: "windows build: ${{ matrix.arch }}"
# needs: create_release # we need to know the upload URL
# strategy:
# fail-fast: true
# matrix:
# arch: [x64]
# steps:
# - uses: actions/checkout@v3
# - name: configure
# run: |
# cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
# - name: build
# run: |
# cmake --build build --config Release
# - name: install
# run: |
# cmake --install build
# - name: package
# run: |
# cd _install
# Compress-Archive -LiteralPath piper-phonemize -DestinationPath piper-phonemize_windows_amd64.zip
# - name: upload
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: _install/piper-phonemize_windows_amd64.zip
# asset_name: piper-phonemize_windows_amd64.zip
# asset_content_type: application/zip
# build_macos:
# runs-on: macos-latest
# name: "mac build: ${{ matrix.arch }}"
# needs: create_release # we need to know the upload URL
# strategy:
# fail-fast: true
# matrix:
# arch: [x64, aarch64]
# steps:
# - uses: actions/checkout@v3
# - name: configure
# run: |
# cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
# - name: build
# run: |
# cmake --build build --config Release
# - name: install
# run: |
# cmake --install build
# - name: package
# run: |
# cd _install && \
# tar -czf piper-phonemize_macos_${{ matrix.arch }}.tar.gz piper-phonemize/
# - name: upload
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: _install/piper-phonemize_macos_${{ matrix.arch }}.tar.gz
# asset_name: piper-phonemize_macos_${{ matrix.arch }}.tar.gz
# asset_content_type: application/octet-stream
86 changes: 43 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,46 @@ jobs:
- uses: docker/setup-buildx-action@v2
- name: build
run: |
docker buildx build . --platform linux/amd64,linux/arm64,linux/arm/v7 --output 'type=local,dest=dist'
# test_windows:
# runs-on: windows-latest
# name: "windows build: ${{ matrix.arch }}"
# strategy:
# fail-fast: true
# matrix:
# arch: [x64]
# steps:
# - uses: actions/checkout@v3
# - name: configure
# run: |
# cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
# - name: build
# run: |
# cmake --build build --config Release
# - name: install
# run: |
# cmake --install build
# - name: check
# run: |
# _install/piper-phonemize/bin/piper_phonemize_exe --help
# test_mac:
# name: "mac test: ${{ matrix.arch }}"
# runs-on: macos-latest
# strategy:
# fail-fast: true
# matrix:
# arch: [x64, aarch64]
# steps:
# - uses: actions/checkout@v3
# - name: configure
# run: |
# cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
# - name: build
# run: |
# cmake --build build --config Release
# - name: install
# run: |
# cmake --install build
# - name: test
# run: |
# DYLD_LIBRARY_PATH=$PWD/_install/piper-phonemize/lib _install/piper-phonemize/bin/piper_phonemize --help
docker buildx build . --platform linux/amd64,linux/arm64,linux/arm/v7
test_windows:
runs-on: windows-latest
name: "windows build: ${{ matrix.arch }}"
strategy:
fail-fast: true
matrix:
arch: [x64]
steps:
- uses: actions/checkout@v3
- name: configure
run: |
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
- name: build
run: |
cmake --build build --config Release
- name: install
run: |
cmake --install build
- name: check
run: |
_install/piper-phonemize/bin/piper_phonemize_exe --help
test_mac:
name: "mac test: ${{ matrix.arch }}"
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
arch: [x64, aarch64]
steps:
- uses: actions/checkout@v3
- name: configure
run: |
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper-phonemize
- name: build
run: |
cmake --build build --config Release
- name: install
run: |
cmake --install build
- name: test
run: |
DYLD_LIBRARY_PATH=$PWD/_install/piper-phonemize/lib _install/piper-phonemize/bin/piper_phonemize --help

0 comments on commit 61eae90

Please sign in to comment.