Improve CI (#181)

This commit is contained in:
Andras Schmelczer 2025-12-10 22:03:13 +00:00 committed by GitHub
parent 8e4ac3a26a
commit 9ac7fdbeb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 44 additions and 33 deletions

View file

@ -16,6 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v4.2.0
@ -31,7 +33,7 @@ jobs:
- name: Setup rust
run: |
cargo install sqlx-cli cargo-machete
which sqlx || cargo install sqlx-cli
cd sync-server
sqlx database create --database-url sqlite://db.sqlite3
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3

View file

@ -20,7 +20,8 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
@ -30,32 +31,15 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: |
cd docs
npm ci
- name: Check formatting
run: |
cd docs
npm run format:check
- name: Check spelling
run: |
cd docs
npm run spell:check
- name: Build documentation
run: |
cd docs
npm run build
- name: Build docs
run: scripts/build-docs.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
@ -67,7 +51,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
runs-on: self-hosted
name: Deploy
steps:
- name: Deploy to GitHub Pages

View file

@ -21,6 +21,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v4.2.0
@ -36,7 +38,7 @@ jobs:
- name: Setup rust
run: |
cargo install sqlx-cli
which sqlx || cargo install sqlx-cli
cd sync-server
sqlx database create --database-url sqlite://db.sqlite3
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3

View file

@ -2,6 +2,7 @@ name: Publish CLI
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
@ -22,6 +23,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0

View file

@ -3,6 +3,8 @@ name: Publish Obsidian plugin
on:
push:
tags: ["*"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
@ -13,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v4.2.0

View file

@ -27,6 +27,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the cosign tool
# https://github.com/sigstore/cosign-installer

View file

@ -118,7 +118,7 @@ async function runTest({
async function runTests(): Promise<void> {
for (let i = 0; i < TEST_ITERATIONS; i++) {
for (const useSlowFileEvents of [false, true]) {
for (const useSlowFileEvents of [true, false]) {
for (const concurrency of [
16,
1 // test with concurrency 1 to check for deadlocks
@ -150,10 +150,6 @@ async function runTests(): Promise<void> {
}
process.on("uncaughtException", (error) => {
if (slowFileEvents) {
return;
}
if (
error instanceof Error &&
error.message.includes(
@ -172,7 +168,12 @@ process.on("unhandledRejection", (error, _promise) => {
return;
}
if (slowFileEvents) {
if (
slowFileEvents &&
error instanceof Error &&
(error.message.includes("Document not found") ||
error.message.includes("Document already exists at new location"))
) {
return;
}

12
scripts/build-docs.sh Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
cd docs
npm ci
npm run format:check
npm run spell:check
npm run build
cd -

View file

@ -20,7 +20,7 @@ else
cargo fmt --all -- --check
fi
cargo install cargo-machete
which cargo-machete || cargo install cargo-machete
cargo machete --with-metadata
echo "Running checks in frontend"

View file

@ -6,7 +6,7 @@ use log::info;
use models::{
DocumentId, DocumentVersionWithoutContent, StoredDocumentVersion, VaultId, VaultUpdateId,
};
use sqlx::{sqlite::SqliteConnectOptions, types::chrono::Utc};
use sqlx::{ConnectOptions, sqlite::SqliteConnectOptions, types::chrono::Utc};
pub mod models;
use sqlx::{Pool, Sqlite, sqlite::SqlitePoolOptions};
@ -105,7 +105,8 @@ impl Database {
.create_if_missing(true)
.auto_vacuum(sqlx::sqlite::SqliteAutoVacuum::Full)
.busy_timeout(Duration::from_secs(3600))
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal);
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
.log_slow_statements(log::LevelFilter::Warn, Duration::from_secs(30));
let pool = SqlitePoolOptions::new()
.max_connections(config.max_connections_per_vault)