-
Notifications
You must be signed in to change notification settings - Fork 36
115 lines (110 loc) · 4.2 KB
/
dep_build_wasm_examples.yml
File metadata and controls
115 lines (110 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# See README.md in this directory for more information about workflow_call
name: Build Wasm Examples
on:
workflow_dispatch: {}
workflow_call:
inputs:
docs_only:
description: Skip building if docs only
required: false
type: string
default: "false"
schedule:
# Run at 1am UTC daily
- cron: '0 1 * * *'
permissions:
packages: write
contents: read
jobs:
build-docker-image:
if: ${{ inputs.docs_only == 'false' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull wasm-clang-builder
continue-on-error: true
run: |
docker pull ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:latest
- name: Set up Docker image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository_owner }}/wasm-clang-builder
- name: Calculate ghcr cache destination
env:
CAN_WRITE: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) && github.actor != 'dependabot[bot]' }}
run: |
if [ "$CAN_WRITE" = "true" ]; then
echo "CACHE_TO=type=registry,ref=ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:buildcache,mode=max" >> $GITHUB_ENV
echo "DO_PUSH=true" >> $GITHUB_ENV
else
echo "CACHE_TO=type=local,dest=/tmp/wasm-clang-builder-cache/" >> $GITHUB_ENV
echo "DO_PUSH=false" >> $GITHUB_ENV
fi
- name: Build and push wasm-clang-builder
# Only push if not from a fork, not from pull request, and not from dependabot
uses: docker/build-push-action@v6
with:
context: src/tests/c_guests/wasmsamples
file: src/tests/c_guests/wasmsamples/dockerfile
load: true
push: ${{ env.DO_PUSH }}
build-args: |
WASI_SDK_VERSION_FULL=25.0
GCC_VERSION=12
tags: ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:buildcache
cache-to: ${{ env.CACHE_TO }}
build-wasm-examples:
needs: build-docker-image
runs-on: ubuntu-latest
strategy:
matrix:
wasmtime_version:
- name: latest
features: ""
- name: lts
features: "wasmtime_lts"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Remove default clang
run: sudo rm /usr/bin/clang
- name: Hyperlight setup workflow
uses: hyperlight-dev/ci-setup-workflow@v1.8.0
with:
rust-toolchain: "1.90"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull wasm-clang-builder
run: |
docker pull ghcr.io/${{ github.repository_owner }}/wasm-clang-builder:latest
- name: Build Modules (wasmtime ${{ matrix.wasmtime_version.name }})
run: |
just ensure-tools
just build-wasm-examples release ${{ matrix.wasmtime_version.features }}
shell: bash
- name: Upload Wasm Modules (wasmtime ${{ matrix.wasmtime_version.name }})
uses: actions/upload-artifact@v4
with:
name: guest-modules-${{ matrix.wasmtime_version.name }}
path: |
x64/release/*.aot