Skip to content

Commit

Permalink
240124
Browse files Browse the repository at this point in the history
  • Loading branch information
TerrorJack committed Jan 24, 2024
0 parents commit 3fe605d
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: build

on:
push:
tags:
- "*"

jobs:
linux:
name: linux-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
steps:

- name: checkout
uses: actions/checkout@v4

- name: install-deps
run: |
sudo apt update
sudo apt install -y \
qemu-user-static
- name: build-image
run: |
pushd "$(mktemp -d)"
curl -f -L --retry 5 https://github.com/tweag/rust-alpine-mimalloc/archive/refs/heads/master.tar.gz | tar xz --strip-components=1
podman build \
--arch ${{ matrix.arch }} \
--network host \
--pull \
--squash \
--tag rust:alpine-mimalloc \
.
popd
- name: build
run: |
podman run \
--arch ${{ matrix.arch }} \
--init \
--network host \
--rm \
--tmpfs /tmp:exec \
--volume $PWD:/workspace \
--workdir /workspace \
rust:alpine-mimalloc \
./build.sh
MIMALLOC_VERBOSE=1 ./bin/wasm-tools --version
MIMALLOC_VERBOSE=1 ./bin/wasmtime --version
MIMALLOC_VERBOSE=1 ./bin/wizer --version
file ./bin/wasm-tools
file ./bin/wasmtime
file ./bin/wizer
mkdir wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}
mv bin wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}
tar \
--sort=name \
--mtime=1970-01-01T00:00:00Z \
--owner=0 --group=0 --numeric-owner \
--use-compress-program="zstd --ultra -22 --threads=0" \
-cf wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.zst \
wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}
path: wasm-tools-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.zst

darwin:
name: darwin-${{ matrix.arch }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
steps:

- name: checkout
uses: actions/checkout@v4

- name: install-deps
run: |
rustup target add ${{ matrix.arch }}-apple-darwin
- name: build
run: |
./build.sh --target ${{ matrix.arch }}-apple-darwin
file ./bin/wasm-tools
file ./bin/wasmtime
file ./bin/wizer
mkdir wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}
mv bin wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}
gtar \
--sort=name \
--mtime=1970-01-01T00:00:00Z \
--owner=0 --group=0 --numeric-owner \
--use-compress-program="zstd --ultra -22 --threads=0" \
-cf wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}.tar.zst \
wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}
path: wasm-tools-${{ github.ref_name }}-darwin-${{ matrix.arch }}.tar.zst
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# `wasm-tools-static`

Static builds of `wasm-tools`, `wasmtime-cli`, `wizer` for
{x86_64,aarch64}-{linux,darwin}:

- `wasm-tools`: `v1.0.56`
- `wasmtime-cli`: `v17.0.0`
- `wizer`: `v4.0.0`
18 changes: 18 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -eu

cargo install \
--all-features \
--config 'profile.release.lto = "thin"' \
--config 'profile.release.strip = "symbols"' \
--root "$PWD" \
wasm-tools wizer ${1+"$@"}

cargo install \
--all-features \
--config 'profile.release.lto = "thin"' \
--root "$PWD" \
--git https://github.com/bytecodealliance/wasmtime.git \
--branch release-17.0.0 \
wasmtime-cli ${1+"$@"}

0 comments on commit 3fe605d

Please sign in to comment.