From 1272e4c530b3a91450c2a06f9973887fa646bbcf Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 14:25:09 +0000 Subject: [PATCH 01/10] Add linux/arm64 to release --- .github/workflows/release.yml | 98 ++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a425a7..ac5eb21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,8 @@ env: GITHUB_REF: '${{ github.ref }}' WINDOWS_TARGET: x86_64-pc-windows-msvc MACOS_TARGET: x86_64-apple-darwin - LINUX_TARGET: x86_64-unknown-linux-musl + LINUX_AMD64_TARGET: x86_64-unknown-linux-musl + LINUX_ARM64_TARGET: aarch64-unknown-linux-musl # Space separated paths to include in the archive. RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT @@ -22,15 +23,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - build: [linux, macos, windows] include: - - build: linux + - target: ${{ env.LINUX_AMD64_TARGET }} os: ubuntu-latest rust: stable - - build: macos + - target: ${{ env.LINUX_ARM64_TARGET }} + os: ubuntu-latest + rust: stable + - target: ${{ env.MACOS_TARGET }} os: macos-latest rust: stable - - build: windows + - target: ${{ env.WINDOWS_TARGET }} os: windows-latest rust: stable @@ -50,66 +53,52 @@ jobs: echo ::set-output name=version::"${GITHUB_REF:10}" - name: Install musl-tools (Linux) - if: matrix.build == 'linux' + if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y sudo apt-get install musl-tools -y - name: Install p7zip (MacOS) - if: matrix.build == 'macos' + if: matrix.os == 'macos-latest' run: brew install p7zip - - name: Build (Linux) - if: matrix.build == 'linux' - run: | - rustup target add ${{ env.LINUX_TARGET }} - cargo build --release --target ${{ env.LINUX_TARGET }} + - name: Add rustup target + run: rustup target add ${{ matrix.target }} - - name: Build (MacOS) - if: matrix.build == 'macos' - run: cargo build --release + - name: Build + run: cargo build --release --target ${{ matrix.target }} - - name: Build (Windows) - if: matrix.build == 'windows' - run: cargo build --release - env: - RUSTFLAGS: -Ctarget-feature=+crt-static + - name: Set RUSTFLAGS (Windows) + if: matrix.os == 'windows-latest' + run: echo "RUSTFLAGS=-Ctarget-feature=+crt-static" >> $GITHUB_ENV - name: Create artifact directory run: | mkdir ${{ env.RELEASE_DIR }} - mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }} - mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }} - mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }} + mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} - - name: Create tarball (Linux) - if: matrix.build == 'linux' + - name: Move binaries (Linux/MacOS) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' run: | - mv ./target/${{ env.LINUX_TARGET }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}/${{ env.RELEASE_BIN }} - mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }} - 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz + mv ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }} + mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} - - name: Create tarball (Windows) - if: matrix.build == 'windows' + - name: Move binaries (Windows) + if: matrix.os == 'windows-latest' shell: bash run: | - cp ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}/${{ env.RELEASE_BIN }}.exe + cp ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}.exe cp ./target/release/${{ env.RELEASE_BIN }}.exe wasm-pack-init.exe - mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }} + mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} mv wasm-pack-init.exe ${{ env.RELEASE_DIR }} - 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz - - name: Create tarball (MacOS) - if: matrix.build == 'macos' - run: | - mv ./target/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}/${{ env.RELEASE_BIN }} - mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }} - 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz + - name: Create tarball + run: 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz - name: Upload Zip uses: actions/upload-artifact@v1 with: - name: ${{ matrix.build }} + name: ${{ matrix.target }} path: ./${{ env.RELEASE_DIR }} release: @@ -133,30 +122,45 @@ jobs: tag_name: ${{ steps.get_version.outputs.VERSION }} release_name: ${{ steps.get_version.outputs.VERSION }} - - name: Download Linux tarball + - name: Download Linux amd64 tarball + uses: actions/download-artifact@v1 + with: + name: ${{ env.LINUX_AMD64_TARGET }} + + - name: Download Linux arm64 tarball uses: actions/download-artifact@v1 with: - name: linux + name: ${{ env.LINUX_ARM64_TARGET }} - name: Download Windows tarball uses: actions/download-artifact@v1 with: - name: windows + name: ${{ env.WINDOWS_TARGET }} - name: Download MacOS tarball uses: actions/download-artifact@v1 with: - name: macos + name: ${{ env.MACOS_TARGET }} + + - name: Release Linux amd64 tarball + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./linux/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz + asset_content_type: application/gzip + asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz - - name: Release Linux tarball + - name: Release Linux arm64 tarball uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./linux/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz + asset_path: ./linux/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz asset_content_type: application/gzip - asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_TARGET }}.tar.gz + asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz - name: Release Windows tarball uses: actions/upload-release-asset@v1 From 8d2e4baf6e8a8196be432f4ceac4e36e54dd4ee4 Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 14:35:22 +0000 Subject: [PATCH 02/10] remove env from matrix --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac5eb21..b468bb7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,16 +24,16 @@ jobs: strategy: matrix: include: - - target: ${{ env.LINUX_AMD64_TARGET }} + - target: x86_64-unknown-linux-musl os: ubuntu-latest rust: stable - - target: ${{ env.LINUX_ARM64_TARGET }} + - target: aarch64-unknown-linux-musl os: ubuntu-latest rust: stable - - target: ${{ env.MACOS_TARGET }} + - target: x86_64-apple-darwin os: macos-latest rust: stable - - target: ${{ env.WINDOWS_TARGET }} + - target: x86_64-pc-windows-msvc os: windows-latest rust: stable From 3737ed523e70b12a2b89cca8270383677d76940d Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 14:53:24 +0000 Subject: [PATCH 03/10] add gcc for aarch64 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b468bb7..4856baf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y - sudo apt-get install musl-tools -y + sudo apt-get install musl-tools gcc-10-aarch64-linux-gnu -y - name: Install p7zip (MacOS) if: matrix.os == 'macos-latest' From c139f6d8c6069e10bac143ff0b3235b929b2dad8 Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 14:57:31 +0000 Subject: [PATCH 04/10] set TARGET_CC --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4856baf..aeeb991 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,8 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y - sudo apt-get install musl-tools gcc-10-aarch64-linux-gnu -y + sudo apt-get install clang -y + echo "TARGET_CC=clang" >> $GITHUB_ENV - name: Install p7zip (MacOS) if: matrix.os == 'macos-latest' From 28abdfb2926aea798cc4d63f0186a57135b3affc Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 15:07:10 +0000 Subject: [PATCH 05/10] add libc6-dev-arm64-cross --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aeeb991..3b396cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y - sudo apt-get install clang -y + sudo apt-get install clang libc6-dev-arm64-cross -y echo "TARGET_CC=clang" >> $GITHUB_ENV - name: Install p7zip (MacOS) From d8a4964300046ba2665402af80006245be5120f9 Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 15:34:59 +0000 Subject: [PATCH 06/10] set arm linker --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b396cb..e18caca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,7 @@ jobs: sudo apt-get update -y sudo apt-get install clang libc6-dev-arm64-cross -y echo "TARGET_CC=clang" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/aarch64-linux-gnu/bin/ld" >> $GITHUB_ENV - name: Install p7zip (MacOS) if: matrix.os == 'macos-latest' From ce69931d7c18ebc74138b5a7d1e1f17e61adee65 Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 15:39:06 +0000 Subject: [PATCH 07/10] set cflags --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e18caca..0740669 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,12 +52,13 @@ jobs: echo "using version tag ${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}" - - name: Install musl-tools (Linux) + - name: Install C compilation tooling (Linux) if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y sudo apt-get install clang libc6-dev-arm64-cross -y echo "TARGET_CC=clang" >> $GITHUB_ENV + echo "CFLAGS_aarch64_unknown_linux_musl=--sysroot=/usr/aarch64-linux-gnu" >> $GITHUB_ENV echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/aarch64-linux-gnu/bin/ld" >> $GITHUB_ENV - name: Install p7zip (MacOS) From a2cc5f577c26a4fdf7571f76979781a21254265c Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 15:55:34 +0000 Subject: [PATCH 08/10] update gcc --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0740669..670c320 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update -y - sudo apt-get install clang libc6-dev-arm64-cross -y + sudo apt-get install clang gcc-aarch64-linux-gnu -y echo "TARGET_CC=clang" >> $GITHUB_ENV echo "CFLAGS_aarch64_unknown_linux_musl=--sysroot=/usr/aarch64-linux-gnu" >> $GITHUB_ENV echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/aarch64-linux-gnu/bin/ld" >> $GITHUB_ENV From 89f73e338a765517624dd109e9aaaf1f798ff24b Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 16:12:05 +0000 Subject: [PATCH 09/10] fix windows --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 670c320..e896e83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,8 +90,8 @@ jobs: if: matrix.os == 'windows-latest' shell: bash run: | - cp ./target/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}.exe - cp ./target/release/${{ env.RELEASE_BIN }}.exe wasm-pack-init.exe + cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}.exe + cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe wasm-pack-init.exe mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} mv wasm-pack-init.exe ${{ env.RELEASE_DIR }} From d1d40f995435e6b8a8009990a8702189e308018e Mon Sep 17 00:00:00 2001 From: Nick Cardin Date: Thu, 30 Sep 2021 16:55:40 +0000 Subject: [PATCH 10/10] use download-artifact@v2 --- .github/workflows/release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e896e83..ea3891b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -126,22 +126,22 @@ jobs: release_name: ${{ steps.get_version.outputs.VERSION }} - name: Download Linux amd64 tarball - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: ${{ env.LINUX_AMD64_TARGET }} - name: Download Linux arm64 tarball - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: ${{ env.LINUX_ARM64_TARGET }} - name: Download Windows tarball - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: ${{ env.WINDOWS_TARGET }} - name: Download MacOS tarball - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v2 with: name: ${{ env.MACOS_TARGET }} @@ -151,7 +151,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./linux/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz + asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz asset_content_type: application/gzip asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz @@ -161,7 +161,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./linux/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz + asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz asset_content_type: application/gzip asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz @@ -171,7 +171,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./windows/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz + asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz asset_content_type: application/gzip asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz @@ -181,7 +181,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./windows/wasm-pack-init.exe + asset_path: ./wasm-pack-init.exe asset_content_type: application/vnd.microsoft.portable-executable asset_name: wasm-pack-init.exe @@ -191,6 +191,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./macos/wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz + asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz asset_content_type: application/gzip asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz