Skip to content

Commit

Permalink
add: GitHub Actions
Browse files Browse the repository at this point in the history
(expected to fail bc there is no setting about GitHub pages)
  • Loading branch information
watasuke102 committed Aug 30, 2024
1 parent 9bdc18f commit 5685d8e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: deploy playground

on:
push:
branches: ["main"]

jobs:
build:
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.0
cache: "npm"
# https://blog.ojisan.io/actions-rs-cargo-ari-nashi/
- name: Setup Rust toolchain
- run: rustup target install wasm32-unknown-unknown
- name: Setup npm packages
run: |
cd playground_front && npm install
- name: Build
run: make playground_all
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./playground_front/dist
publish_branch: playground-github-pages
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
COMPILER = playground_front/public/compiler.wasm
PUBLIC_DIR = playground_front/public
COMPILER = $(PUBLIC_DIR)/compiler.wasm
BACKEND_SRC = $(shell find backend -name '*.rs')
all: playground
playground: $(COMPILER)
cd playground_front && npm run build

$(COMPILER): playground_compiler/src/lib.rs $(BACKEND_SRC)
$(COMPILER): playground_compiler/src/lib.rs $(BACKEND_SRC) $(PUBLIC_DIR)
cargo build --target=wasm32-unknown-unknown --release -p playground_compiler
@cp -v target/wasm32-unknown-unknown/release/playground_compiler.wasm $@

$(PUBLIC_DIR):
mkdir -p $@

test:
cargo test --workspace --exclude playground_compiler

Expand Down

0 comments on commit 5685d8e

Please sign in to comment.