Skip to content

Use WebAssembly.compileStreaming #1006

Use WebAssembly.compileStreaming

Use WebAssembly.compileStreaming #1006

Workflow file for this run

name: Build ruby.wasm
on:
push:
branches: [main]
tags: ["*"]
paths-ignore:
- "*.md"
- "docs/**"
pull_request:
workflow_call:
inputs:
publish:
type: boolean
description: "Whether to publish or not"
default: true
prerel_name:
type: string
description: "Pre-release name to be released"
required: true
secrets:
NODE_AUTH_TOKEN:
required: true
jobs:
lint:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: sudo apt-get install clang-format
- run: ./tools/clang-format-diff.sh
- run: rake check:bindgen
- run: git diff --exit-code
build-builder-image:
strategy:
fail-fast: false
matrix:
entry:
- { target: wasm32-unknown-wasi }
- { target: wasm32-unknown-emscripten }
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- uses: docker/metadata-action@v4
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/ruby.wasm/builder/${{ matrix.entry.target }}
- uses: docker/build-push-action@v4
with:
context: builders/${{ matrix.entry.target }}
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/tags/*' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-rake-task-matrix:
runs-on: ubuntu-20.04
outputs:
entries: ${{ steps.set-matrix.outputs.entries }}
steps:
- uses: actions/checkout@v4
- run: rake ci:pin_build_manifest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: build-manifest
path: build_manifest.json
- name: Set matrix
id: set-matrix
run: |
echo "entries=$(rake ci:rake_task_matrix)" >> $GITHUB_OUTPUT
rake-tasks:
strategy:
fail-fast: false
matrix:
entry: ${{ fromJson(needs.build-rake-task-matrix.outputs.entries) }}
needs: [build-rake-task-matrix]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: build-manifest
- uses: actions/[email protected]
with:
path: ./rubies
key: ${{ matrix.entry.rubies_cache_key }}
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
id: builder-image
with:
context: builders/${{ matrix.entry.builder }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- run: ./bin/setup
- name: Pre-release configuration
run: rake ${{ matrix.entry.prerelease }}[${{ inputs.prerel_name }}]
if: ${{ inputs.prerel_name != '' && matrix.entry.prerelease != '' }}
- name: rake ${{ matrix.entry.task }}
run: docker run -v "$GITHUB_WORKSPACE:/home/me/build" -w /home/me/build -e "RUBYWASM_UID=$(id -u)" -e "RUBYWASM_GID=$(id -g)" -e "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" ${{ steps.builder-image.outputs.imageid }} rake ${{ matrix.entry.task }}
- name: rake ${{ matrix.entry.test }}
run: rake ${{ matrix.entry.test }}
if: ${{ matrix.entry.test != '' }}
- uses: actions/upload-artifact@v3
if: ${{ matrix.entry.artifact }}
with:
name: ${{ matrix.entry.artifact_name }}
path: ${{ matrix.entry.artifact }}
release-artifacts:
needs: [rake-tasks]
runs-on: ubuntu-20.04
if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.publish }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: build-manifest
- uses: actions/download-artifact@v3
with:
path: release
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: echo "PREREL_NAME=${{ inputs.prerel_name }}" >> $GITHUB_ENV
- run: rake "ci:publish[${PREREL_NAME:-$GITHUB_REF_NAME}]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}