logseq/.github/workflows/build.yml

190 lines
4.8 KiB
YAML
Raw Normal View History

2020-11-23 08:48:04 +00:00
name: CI
on:
push:
2022-02-22 15:35:03 +00:00
branches: [master]
2020-11-23 08:48:04 +00:00
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'
2022-01-13 21:35:18 +00:00
# This is the latest node version we can run.
NODE_VERSION: '16'
BABASHKA_VERSION: '0.8.1'
2020-11-23 08:48:04 +00:00
jobs:
2022-01-13 14:40:43 +00:00
test:
strategy:
matrix:
operating-system: [ubuntu-latest]
runs-on: ${{ matrix.operating-system }}
2020-11-23 08:48:04 +00:00
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
2020-11-23 08:48:04 +00:00
with:
cli: ${{ env.CLOJURE_VERSION }}
2020-11-23 08:48:04 +00:00
2021-11-25 13:55:01 +00:00
- name: Clojure cache
uses: actions/cache@v2
id: clojure-deps
2020-11-23 15:00:49 +00:00
with:
2021-11-25 13:55:01 +00:00
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
2020-11-23 15:00:49 +00:00
- name: Fetch yarn deps
2022-04-12 06:06:03 +00:00
run: yarn install --frozen-lockfile
2022-02-22 15:29:48 +00:00
2022-05-10 16:20:02 +00:00
- 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: scripts/carve.clj
- name: Lint for vars that are too large
run: scripts/large_vars.clj
- name: Lint invalid translation entries
run: bb lang:invalid-translations
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2020-11-23 08:48:04 +00:00
2020-11-23 15:00:49 +00:00
- name: Set up Node
2021-06-28 13:09:23 +00:00
uses: actions/setup-node@v2
2020-11-23 15:00:49 +00:00
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 }}
2020-11-23 15:00:49 +00:00
- name: Set up Clojure
2020-11-23 08:48:04 +00:00
uses: DeLaGuardo/setup-clojure@master
with:
cli: ${{ env.CLOJURE_VERSION }}
2020-11-23 08:48:04 +00:00
- name: Clojure cache
uses: actions/cache@v2
id: clojure-deps
2022-01-11 22:41:04 +00:00
with:
path: |
~/.m2/repository
~/.gitlibs
key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
restore-keys: ${{ runner.os }}-clojure-deps-
2022-01-11 22:41:04 +00:00
2021-11-25 13:55:01 +00:00
- name: Fetch Clojure deps
if: steps.clojure-deps.outputs.cache-hit != 'true'
2020-11-23 15:00:49 +00:00
run: clojure -A:cljs -P
- name: Shadow-cljs cache
uses: actions/cache@v2
2020-11-23 15:00:49 +00:00
with:
path: .shadow-cljs
# ensure update cache every time
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
# will match most recent upload
2020-11-23 15:00:49 +00:00
restore-keys: |
${{ runner.os }}-shadow-cljs-
2020-11-23 15:00:49 +00:00
- name: Fetch yarn deps
run: yarn install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
2022-01-11 22:41:04 +00:00
# NOTE: require the app to be build in debug mode(compile instead of build).
- name: Prepare E2E test build
2020-11-23 15:00:49 +00:00
run: |
yarn gulp:build && clojure -M:cljs compile app publishing electron
(cd static && yarn install && yarn rebuild:better-sqlite3)
2021-11-23 06:30:49 +00:00
# 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
2021-11-23 06:30:49 +00:00
- name: Run Playwright test
run: xvfb-run -- yarn e2e-test
2021-11-23 06:30:49 +00:00
env:
CI: true
2021-11-23 06:30:49 +00:00
DEBUG: "pw:test"
- name: Save test artifacts
if: ${{ failure() }}
2021-11-23 06:30:49 +00:00
uses: actions/upload-artifact@v2
with:
name: e2e-test-report
path: artifacts.zip