fix(ci): reduce redundancy in CI (#2037)

This commit is contained in:
Elijah Potter 2025-10-01 09:48:44 -06:00 committed by GitHub
parent 4d2e85e6f8
commit bb2af3ca1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 87 additions and 333 deletions

View file

@ -1,13 +1,16 @@
name: Release Binaries
name: Binaries
on:
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 == false
strategy:
matrix:
@ -136,13 +139,16 @@ jobs:
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
- uses: ncipollo/release-action@v1
with:
artifacts: ${{ matrix.platform.name }}
allowUpdates: true
draft: true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
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: true

View file

@ -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/rust-cache@v2.7.8
- 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"

View file

@ -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/rust-cache@v2.7.8
- 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 }}

View file

@ -8,7 +8,7 @@ on:
merge_group:
jobs:
build:
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

View file

@ -1,15 +1,18 @@
name: Release Chrome Plugin
name: Release Chrome Plugin
on:
push:
tags:
- "v*"
branches: ["master"]
tags: ["v*"]
pull_request:
branches: ["master"]
merge_group:
env:
CARGO_TERM_COLOR: always
jobs:
package:
release-chrome-plugin:
runs-on: ubuntu-latest
steps:
- 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 extension
uses: actions/upload-artifact@v4
with:
@ -38,7 +41,9 @@ jobs:
with:
name: harper-firefox-plugin.zip
path: "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: true

View file

@ -1,4 +1,4 @@
name: Precommit
name: Just Checks
on:
push:
@ -11,8 +11,22 @@ env:
CARGO_TERM_COLOR: always
jobs:
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 }}

View file

@ -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"

View file

@ -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"

View file

@ -1,13 +1,16 @@
name: Release VS Code Plugin
name: VS Code Plugin
on:
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 == false
strategy:
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@v1
with:
artifacts: "./packages/vscode-plugin/*.vsix"
allowUpdates: true
draft: true
- name: Publish to OpenVSX
if: startsWith(github.ref, 'refs/tags/v')
uses: HaaLeo/publish-vscode-extension@v1
with:
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@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}

View file

@ -1,15 +1,18 @@
name: Release WordPress Plugin
name: WordPress Plugin
on:
push:
tags:
- "v*"
branches: ["master"]
tags: ["v*"]
pull_request:
branches: ["master"]
merge_group:
env:
CARGO_TERM_COLOR: always
jobs:
package:
wp-plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@ -19,20 +22,22 @@ jobs:
node-version-file: ".node-version"
- name: Enable Corepack
run: corepack enable
- name: Install `pandoc`
- name: Install pandoc
run: sudo apt-get update && sudo apt-get install pandoc -y
- uses: cargo-bins/cargo-binstall@main
- name: Install `wasm-pack`
- name: Install wasm-pack
run: cargo binstall wasm-pack --force --no-confirm
- name: Build
run: just build-wp
- name: Upload extension
run: just build-wp
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
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@v1
with:
artifacts: "packages/wordpress-plugin/harper.zip"
artifacts: packages/wordpress-plugin/harper.zip
allowUpdates: true
draft: true

View file

@ -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 bash
set -eo pipefail
@ -52,6 +52,7 @@ test-obsidian: build-obsidian
pnpm install
cd "{{justfile_directory()}}/packages/obsidian-plugin"
pnpm playwright install
pnpm test
dev-wp: build-harperjs
@ -260,8 +261,12 @@ check-rust:
cargo fmt -- --check
cargo 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 bash
set -eo pipefail
@ -281,7 +286,6 @@ precommit: check test build-harperjs build-obsidian build-web build-wp build-fir
set -eo pipefail
cargo build --all-targets
cargo hack check --each-feature
# Install `harper-cli` and `harper-ls` to your machine via `cargo`
install:

View file

@ -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",

3
pnpm-lock.yaml generated
View file

@ -259,6 +259,9 @@ importers:
specifier: 'catalog:'
version: 2.8.1
devDependencies:
'@playwright/test':
specifier: ^1.52.0
version: 1.52.0
'@rollup/plugin-node-resolve':
specifier: ^16.0.0
version: 16.0.1(rollup@4.35.0)