mirror of https://github.com/logseq/logseq
190 lines
4.8 KiB
YAML
190 lines
4.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths-ignore:
|
|
- '*.md'
|
|
pull_request:
|
|
branches: [master]
|
|
paths-ignore:
|
|
- '*.md'
|
|
|
|
env:
|
|
CLOJURE_VERSION: '1.10.1.727'
|
|
# setup-java@v2 dropped support for legacy Java version syntax.
|
|
# This is the same as 1.8.
|
|
JAVA_VERSION: '8'
|
|
# This is the latest node version we can run.
|
|
NODE_VERSION: '16'
|
|
BABASHKA_VERSION: '0.8.1'
|
|
|
|
jobs:
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
operating-system: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.operating-system }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'yarn'
|
|
cache-dependency-path: |
|
|
yarn.lock
|
|
static/yarn.lock
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
|
|
- name: Set up Clojure
|
|
uses: DeLaGuardo/setup-clojure@master
|
|
with:
|
|
cli: ${{ env.CLOJURE_VERSION }}
|
|
|
|
- name: Clojure cache
|
|
uses: actions/cache@v2
|
|
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: Run ClojureScript tests
|
|
run: |
|
|
yarn cljs:test
|
|
node static/tests.js
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
|
|
- name: Set up Clojure
|
|
uses: DeLaGuardo/setup-clojure@master
|
|
with:
|
|
cli: ${{ env.CLOJURE_VERSION }}
|
|
|
|
- name: Setup Babashka
|
|
uses: turtlequeue/setup-babashka@v1.3.0
|
|
with:
|
|
babashka-version: ${{ 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 invalid translation entries
|
|
run: bb lang:invalid-translations
|
|
|
|
e2e-test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'yarn'
|
|
cache-dependency-path: |
|
|
yarn.lock
|
|
static/yarn.lock
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
|
|
- name: Set up Clojure
|
|
uses: DeLaGuardo/setup-clojure@master
|
|
with:
|
|
cli: ${{ env.CLOJURE_VERSION }}
|
|
|
|
- name: Clojure cache
|
|
uses: actions/cache@v2
|
|
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: Shadow-cljs cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: .shadow-cljs
|
|
# ensure update cache every time
|
|
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
|
|
# will match most recent upload
|
|
restore-keys: |
|
|
${{ runner.os }}-shadow-cljs-
|
|
|
|
- name: Fetch yarn deps
|
|
run: yarn install
|
|
env:
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
|
|
|
|
# NOTE: require the app to be build in debug mode(compile instead of build).
|
|
- name: Prepare E2E test build
|
|
run: |
|
|
yarn gulp:build && clojure -M:cljs compile app publishing electron
|
|
(cd static && yarn install && yarn rebuild:better-sqlite3)
|
|
|
|
# Exits with 0 if yarn.lock is up to date or 1 if we forgot to update it
|
|
- name: Ensure static yarn.lock is up to date
|
|
run: git diff --exit-code static/yarn.lock
|
|
|
|
- name: Run Playwright test
|
|
run: xvfb-run -- yarn e2e-test
|
|
env:
|
|
CI: true
|
|
DEBUG: "pw:api"
|
|
|
|
- name: Save test artifacts
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: e2e-test-report
|
|
path: artifacts.zip
|