Improve CI (#181)
This commit is contained in:
parent
8e4ac3a26a
commit
9ac7fdbeb7
10 changed files with 44 additions and 33 deletions
4
.github/workflows/check.yml
vendored
4
.github/workflows/check.yml
vendored
|
|
@ -16,6 +16,8 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: actions/setup-node@v4.2.0
|
uses: actions/setup-node@v4.2.0
|
||||||
|
|
@ -31,7 +33,7 @@ jobs:
|
||||||
|
|
||||||
- name: Setup rust
|
- name: Setup rust
|
||||||
run: |
|
run: |
|
||||||
cargo install sqlx-cli cargo-machete
|
which sqlx || cargo install sqlx-cli
|
||||||
cd sync-server
|
cd sync-server
|
||||||
sqlx database create --database-url sqlite://db.sqlite3
|
sqlx database create --database-url sqlite://db.sqlite3
|
||||||
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
||||||
|
|
|
||||||
28
.github/workflows/deploy-docs.yml
vendored
28
.github/workflows/deploy-docs.yml
vendored
|
|
@ -20,7 +20,8 @@ concurrency:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: self-hosted
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -30,32 +31,15 @@ jobs:
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 22
|
||||||
cache: npm
|
cache: npm
|
||||||
cache-dependency-path: docs/package-lock.json
|
cache-dependency-path: docs/package-lock.json
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v4
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Build docs
|
||||||
run: |
|
run: scripts/build-docs.sh
|
||||||
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: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|
@ -67,7 +51,7 @@ jobs:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: self-hosted
|
||||||
name: Deploy
|
name: Deploy
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
|
|
|
||||||
4
.github/workflows/e2e.yml
vendored
4
.github/workflows/e2e.yml
vendored
|
|
@ -21,6 +21,8 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: actions/setup-node@v4.2.0
|
uses: actions/setup-node@v4.2.0
|
||||||
|
|
@ -36,7 +38,7 @@ jobs:
|
||||||
|
|
||||||
- name: Setup rust
|
- name: Setup rust
|
||||||
run: |
|
run: |
|
||||||
cargo install sqlx-cli
|
which sqlx || cargo install sqlx-cli
|
||||||
cd sync-server
|
cd sync-server
|
||||||
sqlx database create --database-url sqlite://db.sqlite3
|
sqlx database create --database-url sqlite://db.sqlite3
|
||||||
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
||||||
|
|
|
||||||
3
.github/workflows/publish-cli-docker.yml
vendored
3
.github/workflows/publish-cli-docker.yml
vendored
|
|
@ -2,6 +2,7 @@ name: Publish CLI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches: ["main"]
|
||||||
tags: ["*"]
|
tags: ["*"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
@ -22,6 +23,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
||||||
|
|
|
||||||
4
.github/workflows/publish-plugin.yml
vendored
4
.github/workflows/publish-plugin.yml
vendored
|
|
@ -3,6 +3,8 @@ name: Publish Obsidian plugin
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ["*"]
|
tags: ["*"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
@ -13,6 +15,8 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: actions/setup-node@v4.2.0
|
uses: actions/setup-node@v4.2.0
|
||||||
|
|
|
||||||
2
.github/workflows/publish-server-docker.yml
vendored
2
.github/workflows/publish-server-docker.yml
vendored
|
|
@ -27,6 +27,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
# Install the cosign tool
|
# Install the cosign tool
|
||||||
# https://github.com/sigstore/cosign-installer
|
# https://github.com/sigstore/cosign-installer
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ async function runTest({
|
||||||
|
|
||||||
async function runTests(): Promise<void> {
|
async function runTests(): Promise<void> {
|
||||||
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
for (const useSlowFileEvents of [false, true]) {
|
for (const useSlowFileEvents of [true, false]) {
|
||||||
for (const concurrency of [
|
for (const concurrency of [
|
||||||
16,
|
16,
|
||||||
1 // test with concurrency 1 to check for deadlocks
|
1 // test with concurrency 1 to check for deadlocks
|
||||||
|
|
@ -150,10 +150,6 @@ async function runTests(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on("uncaughtException", (error) => {
|
process.on("uncaughtException", (error) => {
|
||||||
if (slowFileEvents) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
error instanceof Error &&
|
error instanceof Error &&
|
||||||
error.message.includes(
|
error.message.includes(
|
||||||
|
|
@ -172,7 +168,12 @@ process.on("unhandledRejection", (error, _promise) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slowFileEvents) {
|
if (
|
||||||
|
slowFileEvents &&
|
||||||
|
error instanceof Error &&
|
||||||
|
(error.message.includes("Document not found") ||
|
||||||
|
error.message.includes("Document already exists at new location"))
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
scripts/build-docs.sh
Normal file
12
scripts/build-docs.sh
Normal 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 -
|
||||||
|
|
@ -20,7 +20,7 @@ else
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo install cargo-machete
|
which cargo-machete || cargo install cargo-machete
|
||||||
cargo machete --with-metadata
|
cargo machete --with-metadata
|
||||||
|
|
||||||
echo "Running checks in frontend"
|
echo "Running checks in frontend"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use log::info;
|
||||||
use models::{
|
use models::{
|
||||||
DocumentId, DocumentVersionWithoutContent, StoredDocumentVersion, VaultId, VaultUpdateId,
|
DocumentId, DocumentVersionWithoutContent, StoredDocumentVersion, VaultId, VaultUpdateId,
|
||||||
};
|
};
|
||||||
use sqlx::{sqlite::SqliteConnectOptions, types::chrono::Utc};
|
use sqlx::{ConnectOptions, sqlite::SqliteConnectOptions, types::chrono::Utc};
|
||||||
|
|
||||||
pub mod models;
|
pub mod models;
|
||||||
use sqlx::{Pool, Sqlite, sqlite::SqlitePoolOptions};
|
use sqlx::{Pool, Sqlite, sqlite::SqlitePoolOptions};
|
||||||
|
|
@ -105,7 +105,8 @@ impl Database {
|
||||||
.create_if_missing(true)
|
.create_if_missing(true)
|
||||||
.auto_vacuum(sqlx::sqlite::SqliteAutoVacuum::Full)
|
.auto_vacuum(sqlx::sqlite::SqliteAutoVacuum::Full)
|
||||||
.busy_timeout(Duration::from_secs(3600))
|
.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()
|
let pool = SqlitePoolOptions::new()
|
||||||
.max_connections(config.max_connections_per_vault)
|
.max_connections(config.max_connections_per_vault)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue