From d57fda578c97dc0c02a0a41b5ebfef708985a394 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 6 Nov 2023 13:14:26 -0600 Subject: [PATCH] Try buildx --- .github/workflows/main.yml | 181 ++++++++++++++++++------------------- Makefile | 7 +- 2 files changed, 93 insertions(+), 95 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f478f5..b5b9c75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,8 +3,11 @@ name: main on: workflow_dispatch: push: - tags: - - "*" + branches: + - master + # push: + # tags: + # - "*" jobs: create_release: @@ -24,98 +27,90 @@ jobs: draft: false prerelease: false build_linux: - name: "linux build: ${{ matrix.arch }}" - runs-on: ubuntu-20.04 # use older version on purpose for GLIBC - needs: create_release # we need to know the upload URL - strategy: - fail-fast: true - matrix: - arch: [x64, aarch64, armv7] - steps: - - uses: actions/checkout@v3 - - name: configure - run: | - cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} - - name: build - run: | - cmake --build build --config Release - - name: install - run: | - cmake --install build - - name: package - run: | - cd _install && \ - tar -czf piper_linux_${{ matrix.arch }}.tar.gz piper/ - - 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_linux_${{ matrix.arch }}.tar.gz - asset_name: piper_linux_${{ 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 - - name: build - run: | - cmake --build build --config Release - - name: install - run: | - cmake --install build - - name: package - run: | - cd _install - Compress-Archive -LiteralPath piper -DestinationPath piper_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_windows_amd64.zip - asset_name: piper_windows_amd64.zip - asset_content_type: application/zip - build_macos: - name: "macos build: ${{ matrix.arch }}" - runs-on: macos-latest - needs: create_release # we need to know the upload URL - strategy: - fail-fast: true - matrix: - arch: [x64, aarch64] + name: "linux build" + runs-on: ubuntu-latest + needs: create_release # we need to know the upload URL steps: - uses: actions/checkout@v3 - - name: configure - run: | - cmake -Bbuild -DCMAKE_INSTALL_PREFIX=_install/piper + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 - name: build run: | - cmake --build build --config Release - - name: install - run: | - cmake --install build - - name: package - run: | - cd _install && \ - tar -czf piper_macos_${{ matrix.arch }}.tar.gz piper/ - - 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_macos_${{ matrix.arch }}.tar.gz - asset_name: piper_macos_${{ matrix.arch }}.tar.gz - asset_content_type: application/octet-stream + docker buildx build . --platform linux/arm64 --output 'type=local,dest=dist' + # - name: package + # run: | + # cd _install && \ + # tar -czf piper_linux_${{ matrix.arch }}.tar.gz piper/ + # - 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_linux_${{ matrix.arch }}.tar.gz + # asset_name: piper_linux_${{ 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 + # - name: build + # run: | + # cmake --build build --config Release + # - name: install + # run: | + # cmake --install build + # - name: package + # run: | + # cd _install + # Compress-Archive -LiteralPath piper -DestinationPath piper_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_windows_amd64.zip + # asset_name: piper_windows_amd64.zip + # asset_content_type: application/zip + # build_macos: + # name: "macos build: ${{ matrix.arch }}" + # runs-on: macos-latest + # 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 + # - name: build + # run: | + # cmake --build build --config Release + # - name: install + # run: | + # cmake --install build + # - name: package + # run: | + # cd _install && \ + # tar -czf piper_macos_${{ matrix.arch }}.tar.gz piper/ + # - 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_macos_${{ matrix.arch }}.tar.gz + # asset_name: piper_macos_${{ matrix.arch }}.tar.gz + # asset_content_type: application/octet-stream diff --git a/Makefile b/Makefile index 2ee7ced..28dc33c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean +.PHONY: clean docker all: cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install @@ -6,5 +6,8 @@ all: cd build && ctest --config Release cmake --install build +docker: + docker buildx build . --platform linux/amd64,linux/arm64,linux/arm/v7 --output 'type=local,dest=dist' + clean: - rm -rf build install + rm -rf build install dist