Files
logseq/.github/workflows/build.yml
2026-04-17 20:26:15 +08:00

178 lines
4.9 KiB
YAML

name: CI
on:
push:
branches: [master]
paths-ignore:
- '*.md'
pull_request:
branches: [master]
paths-ignore:
- '*.md'
env:
CLOJURE_VERSION: '1.12.4.1618'
JAVA_VERSION: '21'
# This is the latest node version we can run.
NODE_VERSION: '24'
BABASHKA_VERSION: '1.12.215'
jobs:
typos:
name: Spell Check with Typos
runs-on: ubuntu-22.04
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling with custom config file
uses: crate-ci/typos@v1.16.8
with:
config: ./typos.toml
test:
strategy:
matrix:
operating-system: [ubuntu-22.04]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
uses: DeLaGuardo/setup-clojure@13.5
with:
cli: ${{ env.CLOJURE_VERSION }}
- name: Clojure cache
uses: actions/cache@v4
id: clojure-deps
with:
path: |
~/.m2/repository
~/.gitlibs
key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
restore-keys: ${{ runner.os }}-clojure-deps-
- name: Fetch Clojure deps
if: steps.clojure-deps.outputs.cache-hit != 'true'
run: clojure -A:cljs -P
- name: Fetch yarn deps
run: yarn install --frozen-lockfile
- name: Build test asset
run: clojure -M:test compile test
- name: Run ClojureScript query tests against basic query type
run: DB_QUERY_TYPE=basic node static/tests.js -r frontend.db.query-dsl-test
- name: Run ClojureScript tests
run: yarn cljs:run-test
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
uses: DeLaGuardo/setup-clojure@13.5
with:
cli: ${{ env.CLOJURE_VERSION }}
bb: ${{ env.BABASHKA_VERSION }}
- name: Run clj-kondo lint
run: clojure -M:clj-kondo --parallel --lint src
- name: Carve lint for unused vars
run: bb lint:carve
- name: Lint for vars that are too large
run: bb lint:large-vars
- name: Lint for namespaces that aren't documented
run: bb lint:ns-docstrings
- name: Lint invalid translation entries
run: bb lang:validate-translations
- name: Lint hardcoded user-facing strings
run: bb lang:lint-hardcoded
- name: Lint to keep worker independent of frontend
run: bb lint:worker-and-frontend-separate
db-graph-test:
strategy:
matrix:
operating-system: [ubuntu-latest]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: |
deps/db/yarn.lock
scripts/yarn.lock
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
uses: DeLaGuardo/setup-clojure@13.5
with:
cli: ${{ env.CLOJURE_VERSION }}
bb: ${{ env.BABASHKA_VERSION }}
- name: Fetch scripts yarn deps
run: cd scripts && yarn install --frozen-lockfile
- name: Create DB graph with properties
run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs ./properties-graph
# TODO: Use a smaller, test-focused graph to test classes
- name: Create DB graph with classes
run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs ./schema-graph
- name: Fetch deps/db yarn deps
run: cd deps/db && yarn install --frozen-lockfile
# Can run from deps/db since all JS deps for this command are available in deps/db
- name: Validate created DB graphs
run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli validate -g ../../scripts/properties-graph ../../scripts/schema-graph
- name: Export a created DB graph and confirm the export is idempotent
run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli export-edn -g ../../scripts/properties-graph -f properties.edn --roundtrip