Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(ci): reduce redundancy in CI (#2037)
Elijah Potterbb2af3ca1d16
diff --git a/.github/workflows/release_harper_binaries.yml b/.github/workflows/binaries.ymlsimilarity index 93%rename from .github/workflows/release_harper_binaries.ymlrename to .github/workflows/binaries.ymlindex 5d8519494..2fe3245f9 100644--- a/.github/workflows/release_harper_binaries.yml+++ b/.github/workflows/binaries.yml@@ -1,13 +1,16 @@-name: Release Binaries+name: Binarieson:push:- tags:- - "v*"+ branches: ["master"]+ tags: ["v*"]+ pull_request:+ branches: ["master"]+ merge_group:jobs:- release:- name: Release ${{ matrix.platform.project }} - ${{ matrix.platform.release_for }}+ binaries:+ name: ${{ matrix.platform.project }} - ${{ matrix.platform.release_for }}if: github.event.pull_request.draft == falsestrategy:matrix:@@ -136,13 +139,16 @@ jobs:tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}ficd -- - uses: ncipollo/release-action@v1- with:- artifacts: ${{ matrix.platform.name }}- allowUpdates: true- draft: true- name: Upload Artifactsuses: actions/upload-artifact@v4with:name: ${{ matrix.platform.bin }}-${{ matrix.platform.target }}path: ${{ matrix.platform.name }}++ - name: Release artifacts+ if: startsWith(github.ref, 'refs/tags/v')+ uses: ncipollo/release-action@v1+ with:+ artifacts: ${{ matrix.platform.name }}+ allowUpdates: true+ draft: truediff --git a/.github/workflows/build_chrome_plugin.yml b/.github/workflows/build_chrome_plugin.ymldeleted file mode 100644index 2c7348415..000000000--- a/.github/workflows/build_chrome_plugin.yml+++ /dev/null@@ -1,44 +0,0 @@-name: Build Chrome Plugin--on:- push:- branches: ["master"]- pull_request:- branches: ["master"]- merge_group:--env:- CARGO_TERM_COLOR: always--jobs:- package:- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- - name: Rust Cache- uses: Swatinem/[email protected]- - uses: extractions/setup-just@v2- - uses: actions/setup-node@v4- with:- node-version-file: ".node-version"- - name: Enable Corepack- run: corepack enable- - name: Install `pandoc`- run: sudo apt-get update && sudo apt-get install pandoc -y- - uses: cargo-bins/cargo-binstall@main- - name: Install `wasm-pack`- run: cargo binstall wasm-pack --force --no-confirm- - name: Build Chrome Plugin- run: just build-chrome-plugin- - name: Build Firefox Plugin- run: just build-firefox-plugin- - name: Upload Chrome extension- uses: actions/upload-artifact@v4- with:- name: harper-chrome-plugin.zip- path: "packages/chrome-plugin/package/harper-chrome-plugin.zip"- - name: Upload Firefox extension- uses: actions/upload-artifact@v4- with:- name: harper-firefox-plugin.zip- path: "packages/chrome-plugin/package/harper-firefox-plugin.zip"diff --git a/.github/workflows/build_harper_binaries.yml b/.github/workflows/build_harper_binaries.ymldeleted file mode 100644index 5617e9f51..000000000--- a/.github/workflows/build_harper_binaries.yml+++ /dev/null@@ -1,143 +0,0 @@-name: Build Binaries--on:- push:- branches: ["master"]- merge_group:--jobs:- release:- name: Release ${{ matrix.platform.project }} - ${{ matrix.platform.release_for }}- if: github.event.pull_request.draft == false- strategy:- matrix:- platform:- - release_for: Windows-x86_64- os: windows-latest- target: x86_64-pc-windows-msvc- project: harper-ls- bin: harper-ls.exe- name: harper-ls-x86_64-pc-windows-msvc.zip- command: build- - release_for: macOS-x86_64- os: macOS-latest- target: x86_64-apple-darwin- project: harper-ls- bin: harper-ls- name: harper-ls-x86_64-apple-darwin.tar.gz- command: build- - release_for: macOS-aarch64- os: macOS-latest- target: aarch64-apple-darwin- project: harper-ls- bin: harper-ls- name: harper-ls-aarch64-apple-darwin.tar.gz- command: build- - release_for: Linux-x86_64-GNU- os: ubuntu-latest- target: x86_64-unknown-linux-gnu- project: harper-ls- bin: harper-ls- name: harper-ls-x86_64-unknown-linux-gnu.tar.gz- command: build- - release_for: Linux-aarch64-GNU- os: ubuntu-latest- target: aarch64-unknown-linux-gnu- project: harper-ls- bin: harper-ls- name: harper-ls-aarch64-unknown-linux-gnu.tar.gz- command: build- - release_for: Linux-x86_64-musl- os: ubuntu-latest- target: x86_64-unknown-linux-musl- project: harper-ls- bin: harper-ls- name: harper-ls-x86_64-unknown-linux-musl.tar.gz- command: build- - release_for: Linux-aarch64-musl- os: ubuntu-latest- target: aarch64-unknown-linux-musl- project: harper-ls- bin: harper-ls- name: harper-ls-aarch64-unknown-linux-musl.tar.gz- command: build-- - release_for: Windows-x86_64- os: windows-latest- target: x86_64-pc-windows-msvc- project: harper-cli- bin: harper-cli.exe- name: harper-cli-x86_64-pc-windows-msvc.zip- command: build- - release_for: macOS-x86_64- os: macOS-latest- target: x86_64-apple-darwin- project: harper-cli- bin: harper-cli- name: harper-cli-x86_64-apple-darwin.tar.gz- command: build- - release_for: macOS-aarch64- os: macOS-latest- target: aarch64-apple-darwin- project: harper-cli- bin: harper-cli- name: harper-cli-aarch64-apple-darwin.tar.gz- command: build- - release_for: Linux-x86_64-GNU- os: ubuntu-latest- target: x86_64-unknown-linux-gnu- project: harper-cli- bin: harper-cli- name: harper-cli-x86_64-unknown-linux-gnu.tar.gz- command: build- - release_for: Linux-aarch64-GNU- os: ubuntu-latest- target: aarch64-unknown-linux-gnu- project: harper-cli- bin: harper-cli- name: harper-cli-aarch64-unknown-linux-gnu.tar.gz- command: build- - release_for: Linux-x86_64-musl- os: ubuntu-latest- target: x86_64-unknown-linux-musl- project: harper-cli- bin: harper-cli- name: harper-cli-x86_64-unknown-linux-musl.tar.gz- command: build- - release_for: Linux-aarch64-musl- os: ubuntu-latest- target: aarch64-unknown-linux-musl- project: harper-cli- bin: harper-cli- name: harper-cli-aarch64-unknown-linux-musl.tar.gz- command: build-- runs-on: ${{ matrix.platform.os }}- steps:- - name: Checkout- uses: actions/checkout@v4- - name: Rust Cache- uses: Swatinem/[email protected]- - name: Build binary- uses: houseabsolute/actions-rust-cross@v1- with:- command: ${{ matrix.platform.command }}- target: ${{ matrix.platform.target }}- args: "--locked --release --bin ${{ matrix.platform.project }}"- force-use-cross: ${{ matrix.platform.os == 'ubuntu-latest' }}- strip: true- - name: Package as archive- shell: bash- run: |- cd target/${{ matrix.platform.target }}/release- if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then- 7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}- else- tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}- fi- cd -- - name: Upload Artifacts- uses: actions/upload-artifact@v4- with:- name: ${{ matrix.platform.bin }}-${{ matrix.platform.target }}- path: ${{ matrix.platform.name }}diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.ymlindex c2f785b70..e9ab785a1 100644--- a/.github/workflows/build_web.yml+++ b/.github/workflows/build_web.yml@@ -8,7 +8,7 @@ on:merge_group:jobs:- build:+ build-web:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4diff --git a/.github/workflows/release_chrome_plugin.yml b/.github/workflows/chrome_plugin.ymlsimilarity index 76%rename from .github/workflows/release_chrome_plugin.ymlrename to .github/workflows/chrome_plugin.ymlindex 1e1510724..5ab018788 100644--- a/.github/workflows/release_chrome_plugin.yml+++ b/.github/workflows/chrome_plugin.yml@@ -1,15 +1,18 @@-name: Release Chrome Plugin+name: Release Chrome Pluginon:push:- tags:- - "v*"+ branches: ["master"]+ tags: ["v*"]+ pull_request:+ branches: ["master"]+ merge_group:env:CARGO_TERM_COLOR: alwaysjobs:- package:+ release-chrome-plugin:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4@@ -25,9 +28,9 @@ jobs:- name: Install `wasm-pack`run: cargo binstall wasm-pack --force --no-confirm- name: Build Chrome Plugin- run: just build-chrome-plugin+ run: just build-chrome-plugin- name: Build Firefox Plugin- run: just build-firefox-plugin+ run: just build-firefox-plugin- name: Upload Chrome extensionuses: actions/upload-artifact@v4with:@@ -38,7 +41,9 @@ jobs:with:name: harper-firefox-plugin.zippath: "packages/chrome-plugin/package/harper-firefox-plugin.zip"- - uses: ncipollo/release-action@v1+ - name: Release artifacts+ uses: ncipollo/release-action@v1+ if: startsWith(github.ref, 'refs/tags/v')with:artifacts: "packages/chrome-plugin/package/*.zip"allowUpdates: truediff --git a/.github/workflows/precommit.yml b/.github/workflows/just-checks.ymlsimilarity index 70%rename from .github/workflows/precommit.ymlrename to .github/workflows/just-checks.ymlindex 50ee02643..b0ca1d2a4 100644--- a/.github/workflows/precommit.yml+++ b/.github/workflows/just-checks.yml@@ -1,4 +1,4 @@-name: Precommit+name: Just Checkson:push:@@ -11,8 +11,22 @@ env:CARGO_TERM_COLOR: alwaysjobs:- precommit:+ just-checks:runs-on: ubuntu-latest+ name: just ${{ matrix.task }}+ strategy:+ matrix:+ task:+ [+ check-rust,+ check-js,+ test-harperjs,+ test-vscode,+ test-chrome-plugin,+ test-firefox-plugin,+ test-obsidian,+ build-obsidian,+ ]steps:- uses: actions/checkout@v4- uses: extractions/setup-just@v2@@ -37,7 +51,5 @@ jobs:run: cargo binstall wasm-pack --force --no-confirm- name: Install `cargo hack`run: cargo binstall cargo-hack --force --no-confirm- - name: Run `cargo-hack`- run: cargo hack check --each-feature- - name: Precommit- run: just precommit+ - name: Run `${{ matrix.task }}`+ run: just ${{ matrix.task }}diff --git a/.github/workflows/package_vscode_plugin.yml b/.github/workflows/package_vscode_plugin.ymldeleted file mode 100644index 4dd8f3556..000000000--- a/.github/workflows/package_vscode_plugin.yml+++ /dev/null@@ -1,67 +0,0 @@-name: Package VS Code Plugin--on:- push:- branches: ["master"]- pull_request:- branches: ["master"]- merge_group:--jobs:- package:- name: Package - ${{ matrix.platform.code_target }}- if: github.event.pull_request.draft == false- strategy:- matrix:- platform:- - os: windows-latest- rust_target: x86_64-pc-windows-msvc- code_target: win32-x64- - os: macOS-latest- rust_target: x86_64-apple-darwin- code_target: darwin-x64- - os: macOS-latest- rust_target: aarch64-apple-darwin- code_target: darwin-arm64- - os: ubuntu-latest- rust_target: x86_64-unknown-linux-gnu- code_target: linux-x64- - os: ubuntu-latest- rust_target: aarch64-unknown-linux-gnu- code_target: linux-arm64- runs-on: ${{ matrix.platform.os }}- steps:- - uses: actions/checkout@v4- - uses: extractions/setup-just@v2- - uses: actions/setup-node@v4- with:- node-version-file: ".node-version"- - name: Enable Corepack- run: corepack enable- - name: Build harper-ls- uses: houseabsolute/actions-rust-cross@v1- with:- target: ${{ matrix.platform.rust_target }}- args: "--locked --release --bin harper-ls"- force-use-cross: ${{ matrix.platform.os == 'ubuntu-latest' }}- strip: true- - name: Package extension- shell: bash- run: |- bin_dir="packages/vscode-plugin/bin"- release_dir="target/${{ matrix.platform.rust_target }}/release"-- mkdir "$bin_dir"-- if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then- cp "${release_dir}/harper-ls.exe" "$bin_dir"- else- cp "${release_dir}/harper-ls" "$bin_dir"- fi-- just package-vscode ${{ matrix.platform.code_target }}- - name: Upload extension- uses: actions/upload-artifact@v4- with:- name: ${{ matrix.platform.code_target }}- path: "packages/vscode-plugin/*.vsix"diff --git a/.github/workflows/package_wp_plugin.yml b/.github/workflows/package_wp_plugin.ymldeleted file mode 100644index 406ec035f..000000000--- a/.github/workflows/package_wp_plugin.yml+++ /dev/null@@ -1,35 +0,0 @@-name: Package WordPress Plugin--on:- push:- branches: ["master"]- pull_request:- branches: ["master"]- merge_group:--env:- CARGO_TERM_COLOR: always--jobs:- package:- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- - uses: extractions/setup-just@v2- - uses: actions/setup-node@v4- with:- node-version-file: ".node-version"- - name: Enable Corepack- run: corepack enable- - name: Install `pandoc`- run: sudo apt-get update && sudo apt-get install pandoc -y- - uses: cargo-bins/cargo-binstall@main- - name: Install `wasm-pack`- run: cargo binstall wasm-pack --force --no-confirm- - name: Precommit- run: just build-wp- - name: Upload extension- uses: actions/upload-artifact@v4- with:- name: harper.zip- path: "packages/wordpress-plugin/harper.zip"diff --git a/.github/workflows/release_vscode_plugin.yml b/.github/workflows/vscode_plugin.ymlsimilarity index 86%rename from .github/workflows/release_vscode_plugin.ymlrename to .github/workflows/vscode_plugin.ymlindex 3497fce4a..9e49983fe 100644--- a/.github/workflows/release_vscode_plugin.yml+++ b/.github/workflows/vscode_plugin.yml@@ -1,13 +1,16 @@-name: Release VS Code Plugin+name: VS Code Pluginon:push:- tags:- - "v*"+ branches: ["master"]+ tags: ["v*"]+ pull_request:+ branches: ["master"]+ merge_group:jobs:- package:- name: Package - ${{ matrix.platform.code_target }}+ vscode-plugin:+ name: ${{ matrix.platform.code_target }}if: github.event.pull_request.draft == falsestrategy:matrix:@@ -60,12 +63,15 @@ jobs:just package-vscode ${{ matrix.platform.code_target }}echo artifact=$(echo packages/vscode-plugin/*.vsix) >> $GITHUB_OUTPUT- - uses: ncipollo/release-action@v1+ - name: Release artifacts+ if: startsWith(github.ref, 'refs/tags/v')+ uses: ncipollo/release-action@v1with:artifacts: "./packages/vscode-plugin/*.vsix"allowUpdates: truedraft: true- name: Publish to OpenVSX+ if: startsWith(github.ref, 'refs/tags/v')uses: HaaLeo/publish-vscode-extension@v1with:pat: ${{ secrets.OPEN_VSX_TOKEN }}@@ -73,6 +79,7 @@ jobs:extensionFile: ${{ steps.package_extension.outputs.artifact }}skipDuplicate: true- name: Publish to the Visual Studio Marketplace+ if: startsWith(github.ref, 'refs/tags/v')uses: HaaLeo/publish-vscode-extension@v1with:pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}diff --git a/.github/workflows/release_wp_plugin.yml b/.github/workflows/wp_plugin.ymlsimilarity index 57%rename from .github/workflows/release_wp_plugin.ymlrename to .github/workflows/wp_plugin.ymlindex f3314db24..db782e6ef 100644--- a/.github/workflows/release_wp_plugin.yml+++ b/.github/workflows/wp_plugin.yml@@ -1,15 +1,18 @@-name: Release WordPress Plugin+name: WordPress Pluginon:push:- tags:- - "v*"+ branches: ["master"]+ tags: ["v*"]+ pull_request:+ branches: ["master"]+ merge_group:env:CARGO_TERM_COLOR: alwaysjobs:- package:+ wp-plugin:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4@@ -19,20 +22,22 @@ jobs:node-version-file: ".node-version"- name: Enable Corepackrun: corepack enable- - name: Install `pandoc`+ - name: Install pandocrun: sudo apt-get update && sudo apt-get install pandoc -y- uses: cargo-bins/cargo-binstall@main- - name: Install `wasm-pack`+ - name: Install wasm-packrun: cargo binstall wasm-pack --force --no-confirm- name: Build- run: just build-wp- - name: Upload extension+ run: just build-wp+ - name: Upload artifactuses: actions/upload-artifact@v4with:name: harper.zip- path: "packages/wordpress-plugin/harper.zip"- - uses: ncipollo/release-action@v1+ path: packages/wordpress-plugin/harper.zip+ - name: Draft GitHub release+ if: startsWith(github.ref, 'refs/tags/v')+ uses: ncipollo/release-action@v1with:- artifacts: "packages/wordpress-plugin/harper.zip"+ artifacts: packages/wordpress-plugin/harper.zipallowUpdates: truedraft: truediff --git a/justfile b/justfileindex f83133564..dc9bed646 100644--- a/justfile+++ b/justfile@@ -25,7 +25,7 @@ build-harperjs: build-wasm./docs.sh# Build the browser lint framework module-build-lint-framework:+build-lint-framework: build-harperjs#!/usr/bin/env bashset -eo pipefail@@ -52,6 +52,7 @@ test-obsidian: build-obsidianpnpm installcd "{{justfile_directory()}}/packages/obsidian-plugin"+ pnpm playwright installpnpm testdev-wp: build-harperjs@@ -260,8 +261,12 @@ check-rust:cargo fmt -- --checkcargo clippy -- -Dwarnings -D clippy::dbg_macro -D clippy::needless_raw_string_hashes+ cargo hack check --each-feature+# Perform format and type checking.-check: check-rust build-web+check: check-rust check-js build-web++check-js: build-harperjs build-lint-framework#!/usr/bin/env bashset -eo pipefail@@ -281,7 +286,6 @@ precommit: check test build-harperjs build-obsidian build-web build-wp build-firset -eo pipefailcargo build --all-targets- cargo hack check --each-feature# Install `harper-cli` and `harper-ls` to your machine via `cargo`install:diff --git a/packages/obsidian-plugin/package.json b/packages/obsidian-plugin/package.jsonindex 443160d06..6072b2c87 100644--- a/packages/obsidian-plugin/package.json+++ b/packages/obsidian-plugin/package.json@@ -4,6 +4,7 @@"version": "0.65.0","main": "main.js","devDependencies": {+ "@playwright/test": "^1.52.0","@rollup/plugin-node-resolve": "^16.0.0","@types/lodash-es": "^4.17.12","@vitest/browser": "^3.0.6",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b0fd4697e..d55e5da50 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -259,6 +259,9 @@ importers:specifier: 'catalog:'version: 2.8.1devDependencies:+ '@playwright/test':+ specifier: ^1.52.0+ version: 1.52.0'@rollup/plugin-node-resolve':specifier: ^16.0.0version: 16.0.1([email protected])