Skip to content

Commit

Permalink
✨ add zola slug strategy (#1419)
Browse files Browse the repository at this point in the history
* add zola slug strategy

* make it build and use the same version zola uses

* I don't think we need the async experiment

* fix: make it compile and work with dirty hack

* fix: fix indentation

* fix: update test.yml to match main.yml

* fix: fix workflows

* fix: remove unused dependency

* fix: add repository field to cargo toml

* chore: update deprecated actions

* fix: fix regression so it builds again

* add tmp folders to gitignore

* fix: fix workflows, globs don't expand in github actions

* fix: set shell variables correctly

* fix: use find instead of ld

* fix: forgot to use $env:

* fix: try export

* fix:dont't use pwsh

* test

* fix: i don't know how to test the wasm using the test suite because i'm not sure where to asynchronously import the module

* test

* test

* this should work now and produces working extensions

* fix: make test suite work hopefully

* fix: ok now it should really really work

* fix: make webpack copy the wasm module to the correct path

* fix: remove unnecessary command in ci

* fix: remove unnecessary stuff

* correctly slugfiy anchors

* test in release mode to avoid second compilation

* move wasm initialization to a better place

* wait for wasm to import

* adding a while loop doesn't work so we just have to fail the first time?

* this might fail the first time but it's the best solution I can come up with currently

* move this inside the switch statement

* since import takes only a few milliseconds on 3 year old hardware we might be able to just do it for all users?

* do error handling

* add some comments
  • Loading branch information
float3 authored May 7, 2024
1 parent d2862ca commit 895dfe3
Show file tree
Hide file tree
Showing 14 changed files with 3,719 additions and 408 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,54 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: "Setup Node.js environment"
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "14"
node-version: "20"
cache: "npm"

- name: Setup Rust Toolchain for GitHub CI
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: "Install dependencies"
run: |
npm run build-wasm
npm ci
npm install -g vsce@"^2.5"
# Our prepublish script runs in production mode by default.
# We should run tests against debug build to make error messages as useful as possible.
- name: "Build"
shell: pwsh
- name: "Build release"
run: |
vsce package --pre-release
$env:NODE_ENV = 'development'
vsce package --pre-release --out debug.vsix
npx vsce package --pre-release
export NODE_ENV='development'
npx vsce package --pre-release --out debug.vsix
- name: Test
uses: GabrielBB/xvfb-action@v1.0
with:
run: npm test

- name: "Rust test"
run: |
cd ./src/zola-slug/
cargo test --release
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Markdown-All-in-One-${{ github.sha }}
path: ./*.vsix

# If the run failed, npm log may help to diagnose.
- name: "(debug) Upload npm log"
if: ${{ !success() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: "npm-debug-log"
path: "~/.npm/_logs"
26 changes: 18 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,43 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: "Setup Node.js environment"
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "14"
node-version: "20"
cache: "npm"

- name: Setup Rust Toolchain for GitHub CI
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: "Install dependencies"
run: |
npm run build-wasm
npm ci
npm install -g vsce@"^2.5"
- name: "Build debug"
shell: pwsh
run: |
$env:NODE_ENV = 'development'
vsce package --out debug.vsix
export NODE_ENV='development'
npx vsce package --pre-release --out debug.vsix
- name: Test
uses: GabrielBB/xvfb-action@v1.0
with:
run: npm test

- name: "Rust test"
run: |
cd ./src/zola-slug/
cargo test --release
- name: "(debug) Upload npm log"
if: ${{ !success() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: "npm-debug-log"
path: "~/.npm/_logs"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tmp

# The welcome materials
/welcome/**
/changes.md
/changes.md
Loading

0 comments on commit 895dfe3

Please sign in to comment.