Skip to content

Commit

Permalink
new: Integrate moon. (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Jan 17, 2025
1 parent ff33203 commit a87aa36
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 96 deletions.
95 changes: 63 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,81 @@ on:
- master
pull_request:

env:
# For setup-rust
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
format:
name: Format
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
cache: false
components: rustfmt
- run: cargo fmt --all --check
lint:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
cache: false
components: clippy
- run: cargo clippy --workspace --all-targets
test:
name: Test
# format:
# name: Format
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest]
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: moonrepo/setup-rust@v1
# with:
# cache: false
# components: rustfmt
# - run: cargo fmt --all --check
# lint:
# name: Lint
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest]
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: moonrepo/setup-rust@v1
# with:
# cache: false
# components: clippy
# - run: cargo clippy --workspace --all-targets
# test:
# name: Test
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: moonrepo/setup-rust@v1
# with:
# bins: cargo-nextest
# cache: false # Runs out of disk space
# - uses: moonrepo/setup-toolchain@v0
# with:
# moon-version: latest
# - uses: moonrepo/build-wasm-plugin@v0
# - run: cargo nextest run --no-default-features
ci:
name: Checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
job: [0, 1, 2]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: moonrepo/setup-rust@v1
with:
bins: cargo-nextest
cache: false # Runs out of disk space
components: clippy, rustfmt
targets: wasm32-wasip1
- uses: moonrepo/setup-toolchain@v0
with:
moon-version: latest
- uses: moonrepo/build-wasm-plugin@v0
- run: cargo nextest run --no-default-features
- run: moon ci --color --log debug --job ${{ matrix.job }} --jobTotal 3
- uses: moonrepo/run-report-action@v1
if: success() || failure()
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
matrix: ${{ toJSON(matrix) }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ target/

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# moon
.moon/cache
.moon/docker
51 changes: 51 additions & 0 deletions .moon/tasks/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$schema: "https://moonrepo.dev/schemas/tasks.json"

fileGroups:
cargo:
- "Cargo.toml"
# - "/.cargo/config.toml"
- "/rust-toolchain.toml"
sources:
- "src/**/*"
tests:
- "benches/**/*"
- "tests/**/*"

tasks:
build:
command: "cargo build --target wasm32-wasip1"
inputs:
- "@group(cargo)"
- "@group(sources)"
env: &env
CARGO_TERM_COLOR: "always"
# CARGO_TERM_QUIET: "true"

check:
command: "cargo check --all-targets"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
env: *env

lint:
command: "cargo clippy --all-targets"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
env: *env

test:
command: "cargo nextest run --no-default-features --no-tests=pass"
deps:
- "build"
inputs:
- "@group(cargo)"
- "@group(sources)"
- "@group(tests)"
# - "/.config/nextest.*"
env:
<<: *env
NO_COLOR: "true"
8 changes: 8 additions & 0 deletions .moon/toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$schema: "https://moonrepo.dev/schemas/toolchain.json"

rust:
version: "1.84.0"
bins: ["cargo-nextest"]
components: ["clippy", "rustfmt"]
targets: ["wasm32-wasip1"]
syncToolchainConfig: true
10 changes: 10 additions & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$schema: "https://moonrepo.dev/schemas/workspace.json"

projects:
- "crates/*"
- "extensions/*"
- "tools/*"
- "."

runner:
logRunningCommand: true
22 changes: 12 additions & 10 deletions .prototools
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# moon = "1.31.1"

[plugins]
bun-test = "file://./target/wasm32-wasi/debug/bun_tool.wasm"
deno-test = "file://./target/wasm32-wasi/debug/deno_tool.wasm"
go-test = "file://./target/wasm32-wasi/debug/go_tool.wasm"
# internal-schema = "file://./target/wasm32-wasi/debug/schema_tool.wasm"
bun-test = "file://./target/wasm32-wasip1/debug/bun_tool.wasm"
deno-test = "file://./target/wasm32-wasip1/debug/deno_tool.wasm"
go-test = "file://./target/wasm32-wasip1/debug/go_tool.wasm"
# internal-schema = "file://./target/wasm32-wasip1/debug/schema_tool.wasm"
moon-test = "https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
node-test = "file://./target/wasm32-wasi/debug/node_tool.wasm"
npm-test = "file://./target/wasm32-wasi/debug/node_depman_tool.wasm"
pnpm-test = "file://./target/wasm32-wasi/debug/node_depman_tool.wasm"
python-test = "file://./target/wasm32-wasi/debug/python_tool.wasm"
rust-test = "file://./target/wasm32-wasi/debug/rust_tool.wasm"
yarn-test = "file://./target/wasm32-wasi/debug/node_depman_tool.wasm"
node-test = "file://./target/wasm32-wasip1/debug/node_tool.wasm"
npm-test = "file://./target/wasm32-wasip1/debug/node_depman_tool.wasm"
pnpm-test = "file://./target/wasm32-wasip1/debug/node_depman_tool.wasm"
python-test = "file://./target/wasm32-wasip1/debug/python_tool.wasm"
rust-test = "file://./target/wasm32-wasip1/debug/rust_tool.wasm"
yarn-test = "file://./target/wasm32-wasip1/debug/node_depman_tool.wasm"
Loading

0 comments on commit a87aa36

Please sign in to comment.