Skip to content
Open
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
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
jobs = 8
83 changes: 67 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
name: CI

on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:

permissions:
checks: write
pull-requests: write
env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
prefix-key: v1-rust-${{ matrix.os }}
shared-key: debug
cache-all-crates: true
timeout-minutes: 10
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: runner.os != 'Windows'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
- name: Install moonbit
components: rustfmt, clippy
- name: Setup Rust
if: runner.os == 'Windows'
run: |
rustup toolchain install stable --profile default --no-self-update
rustup default stable
rustup component add rustfmt clippy
rustup target add wasm32-wasip1
- name: Install moonbit (Unix)
if: runner.os != 'Windows'
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: Install moonbit (Windows)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library's purpose is to embed the moonbit compiler in a way that the users don't have to install it separately (it contains a version of it compiled to WASM, executed on V8). So the CI definitely should not install the moonbit compiler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I realized it's needed for bundling the core library.

if: runner.os == 'Windows'
shell: powershell
run: |
$env:MOONBIT_INSTALL_VERSION = "0.6.19"
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
$ProgressPreference = 'SilentlyContinue'
try {
$script = Invoke-RestMethod -Uri "https://cli.moonbitlang.com/install/powershell.ps1" -TimeoutSec 120
Invoke-Expression $script
} catch {
Write-Error "Failed to download or execute MoonBit installer: $_"
exit 1
}
echo "$env:USERPROFILE\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Bundle core MoonBit library
run: moon bundle --target wasm
working-directory: core
Expand All @@ -46,28 +70,55 @@ jobs:
run: cargo build --all-features --all-targets
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
prefix-key: v1-rust-${{ matrix.os }}
shared-key: debug
cache-all-crates: false
timeout-minutes: 10
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: runner.os != 'Windows'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Setup Rust
if: runner.os == 'Windows'
run: |
rustup toolchain install stable --profile default --no-self-update
rustup default stable
rustup component add rustfmt clippy
rustup target add wasm32-wasip1
- uses: cargo-bins/cargo-binstall@main
- name: Install wasmtime-cli
run: cargo binstall --force --locked [email protected]
- name: Install moonbit
- name: Install moonbit (Unix)
if: runner.os != 'Windows'
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- name: Install moonbit (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$env:MOONBIT_INSTALL_VERSION = "0.6.19"
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
$ProgressPreference = 'SilentlyContinue'
try {
$script = Invoke-RestMethod -Uri "https://cli.moonbitlang.com/install/powershell.ps1" -TimeoutSec 120
Invoke-Expression $script
} catch {
Write-Error "Failed to download or execute MoonBit installer: $_"
exit 1
}
echo "$env:USERPROFILE\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Bundle core MoonBit library
run: moon bundle --target wasm
working-directory: core
Expand All @@ -83,7 +134,7 @@ jobs:
publish:
needs: [test]
if: "startsWith(github.ref, 'refs/tags/v')"
runs-on: ubuntu-latest
runs-on: ubuntu-latest # Publish on Ubuntu only
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
Loading