Skip to content

Commit

Permalink
Move validation and id-generation logic into Rust (#32)
Browse files Browse the repository at this point in the history
* Move validation and id-generation logic into Rust

* Update license, CI

* Fix CI

* Fix CI again

* Add missing JS dep

* Lock dependencies in CI. Update README
  • Loading branch information
willcrichton authored Sep 20, 2023
1 parent 0930658 commit b2df881
Show file tree
Hide file tree
Showing 66 changed files with 51,401 additions and 1,528 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on:
push:
branches:
- "**"
- "main"
tags-ignore:
- "v*"
pull_request:
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ jobs:
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Install spellchecker
run: |
npm install -g spellchecker node-gyp
echo "NODE_PATH=$(npm config get prefix)/lib/node_modules" >> $GITHUB_ENV
- name: Install cargo-make
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-make
- name: Install Depot
run: |
curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Initialize TS bindings
run: cargo make init-bindings
- name: Build Rust package
uses: actions-rs/cargo@v1
with:
command: build
args: --release
run: cargo build -p mdbook-quiz --release --locked
- name: Package artifact
run: tar -czf mdbook-quiz-${{ matrix.target }}.tar.gz mdbook-quiz
working-directory: target/release
Expand Down Expand Up @@ -75,11 +74,13 @@ jobs:
- uses: actions/checkout@v2
- name: Setup
uses: ./.github/workflows/setup
- uses: actions-rs/cargo@v1
with:
command: publish
# --allow-dirty needed for js/dist files
args: --allow-dirty --token ${{ secrets.CARGO_TOKEN }}
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-workspaces
- name: Cargo release
# --allow-dirty needed for js/dist files
run: cargo workspace publish --allow-dirty --token ${{ secrets.CARGO_TOKEN }}
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
Expand All @@ -90,7 +91,7 @@ jobs:
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
- name: Install mdbook-quiz
run: cargo install --path . --debug --locked
run: cargo install --path crates/mdbook-quiz --debug --locked
- name: Build example mdbook
run: mdbook build
working-directory: example
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ runs:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Install spellchecker
run: |
npm install -g spellchecker node-gyp
echo "NODE_PATH=$(npm config get prefix)/lib/node_modules" >> $GITHUB_ENV
shell: bash
- name: Install cargo-make
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-make
- name: Install Depot
run: curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
shell: bash
# Note: we have to build before test so the build script is executed
- name: Build Rust package
run: cargo build
- name: Initialize TS bindings
run: cargo make init-bindings
shell: bash
- name: Test Rust package
run: cargo test
run: cargo test --locked
shell: bash
- name: Lint Rust package
run: cargo clippy -- -D warnings
run: cargo clippy --locked -- -D warnings
shell: bash
- name: Test JS package
run: depot test
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.pnpm-debug.log
target/
bindings/
.pnpm-debug.log
Loading

0 comments on commit b2df881

Please sign in to comment.