Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI action to build WASM #23

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ci

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build
run: |
./build-with-docker.sh
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./build/llvm/bin/llvm-box.wasm
./build/llvm/bin/llvm-box.mjs
retention-days: 7

release:
needs: build
name: Create Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: softprops/action-gh-release@v1
with:
files: dist/*.*
- name: Setup npmrc
run: |
echo "@jprendes:registry=https://npm.pkg.github.com/" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{secrets.GITHUB_TOKEN}}" >> .npmrc
- name: Publish
run: npm publish
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.github
box_src
build
demo
docker
emlib
packs
patches
quicknode
src
tooling
upstream
.gitignore
*.sh
node_modules
yarn.lock
2 changes: 1 addition & 1 deletion build-with-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ popd
mkdir -p $(pwd)/build/emsdk_cache

docker run \
-it --rm \
-i --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):$(pwd) \
-v $(pwd)/build/emsdk_cache:/emsdk/upstream/emscripten/cache \
Expand Down
5 changes: 5 additions & 0 deletions llvm-box.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface FsModule extends EmscriptenModule {
FS: typeof FS;
}

export default Module as EmscriptenModuleFactory<FsModule>;
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@jprendes/emception",
"version": "1.0.0",
"author": "jprendes",
"license": "MIT",
"main": "dist/llvm-box.mjs",
"type": "module",
"types": "llvm-box.d.mts",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"dependencies": {
"@types/emscripten": "^1.39.8"
}
}
Loading