logseq/.github/workflows/build.yml

209 lines
5.7 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:
2023-02-21 15:02:58 +00:00
CLOJURE_VERSION: '1.10.1.763'
JAVA_VERSION: '11'
2022-01-13 21:35:18 +00:00
# This is the latest node version we can run.
NODE_VERSION: '18'
2022-12-08 16:22:01 +00:00
BABASHKA_VERSION: '1.0.168'
2020-11-23 08:48:04 +00:00
jobs:
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling with custom config file
uses: crate-ci/typos@v1.13.10
with:
config: ./typos.toml
2020-11-23 08:48:04 +00:00
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Set up Node
2022-11-30 05:23:06 +00:00
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: |
yarn.lock
static/yarn.lock
- name: Set up Java
2022-11-30 05:23:06 +00:00
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
2022-11-30 05:23:06 +00:00
uses: DeLaGuardo/setup-clojure@10.1
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
2022-11-30 05:23:06 +00:00
uses: actions/cache@v3
2021-11-25 13:55:01 +00:00
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3
- name: Set up Java
2022-11-30 05:23:06 +00:00
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Clojure
2022-11-30 05:23:06 +00:00
uses: DeLaGuardo/setup-clojure@10.1
with:
cli: ${{ env.CLOJURE_VERSION }}
2022-11-30 05:23:06 +00:00
bb: ${{ env.BABASHKA_VERSION }}
- name: Run clj-kondo lint
run: clojure -M:clj-kondo --parallel --lint src
- name: Carve lint for unused vars
2022-10-10 05:14:50 +00:00
run: bb lint:carve 2>/dev/null
- name: Lint for vars that are too large
2022-10-10 05:14:50 +00:00
run: bb lint:large-vars 2>/dev/null
- name: Lint for namespaces that aren't documented
2022-10-10 05:14:50 +00:00
run: bb lint:ns-docstrings 2>/dev/null
- name: Lint invalid translation entries
run: bb lang:validate-translations
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
2020-11-23 08:48:04 +00:00
2020-11-23 15:00:49 +00:00
- name: Set up Node
2022-11-30 05:23:06 +00:00
uses: actions/setup-node@v3
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
2022-11-30 05:23:06 +00:00
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
2020-11-23 15:00:49 +00:00
- name: Set up Clojure
2022-11-30 05:23:06 +00:00
uses: DeLaGuardo/setup-clojure@10.1
2020-11-23 08:48:04 +00:00
with:
cli: ${{ env.CLOJURE_VERSION }}
2020-11-23 08:48:04 +00:00
- name: Clojure cache
2023-02-21 15:02:58 +00:00
uses: actions/cache@v3
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
2022-11-30 05:23:06 +00:00
uses: actions/cache@v3
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:all)
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
2023-05-22 09:41:31 +00:00
- name: Install fluxbox
2023-05-22 09:55:29 +00:00
run: sudo apt-get update && apt-get install -y fluxbox
2023-05-22 09:41:31 +00:00
- name: Run Playwright test - 1/2
2023-05-22 09:41:31 +00:00
run: Xvfb :1 -screen 0 "1280x720x24" >/dev/null 2>&1 & export DISPLAY=:1.0 fluxbox >/dev/null 2>&1 & npx playwright test --reporter github --shard=1/2
2021-11-23 06:30:49 +00:00
env:
LOGSEQ_CI: true
2022-07-06 14:01:42 +00:00
DEBUG: "pw:api"
RELEASE: true # skip dev only test
- name: Run Playwright test - 2/2
2023-05-22 09:41:31 +00:00
run: Xvfb :1 -screen 0 "1280x720x24" >/dev/null 2>&1 & export DISPLAY=:1.0 fluxbox >/dev/null 2>&1 & npx playwright test --reporter github --shard=2/2
env:
LOGSEQ_CI: true
DEBUG: "pw:api"
RELEASE: true # skip dev only test
2021-11-23 06:30:49 +00:00
2022-12-01 07:19:55 +00:00
- name: Save test artifacts
if: ${{ failure() }}
2022-11-30 05:23:06 +00:00
uses: actions/upload-artifact@v3
2021-11-23 06:30:49 +00:00
with:
2022-12-01 07:19:55 +00:00
name: e2e-test-report
2022-11-29 05:03:41 +00:00
path: e2e-dump/*
2022-11-30 11:29:18 +00:00
retention-days: 1