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'
|
|
|
|
|
2021-04-08 17:15:54 +00:00
|
|
|
env:
|
|
|
|
CLOJURE_VERSION: '1.10.1.727'
|
2022-01-13 03:57:51 +00:00
|
|
|
# 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.
|
2022-01-13 03:57:51 +00:00
|
|
|
NODE_VERSION: '16'
|
2022-03-08 22:27:26 +00:00
|
|
|
BABASHKA_VERSION: '0.7.7'
|
2021-04-08 17:15:54 +00:00
|
|
|
|
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
|
2022-01-13 03:57:51 +00:00
|
|
|
|
|
|
|
- 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:
|
2022-01-13 03:57:51 +00:00
|
|
|
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-
|
2022-01-24 21:41:07 +00:00
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- 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
|
|
|
|
2022-01-13 03:57:51 +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-01-13 03:57:51 +00:00
|
|
|
- name: Run ClojureScript test
|
|
|
|
run: |
|
|
|
|
yarn cljs:test
|
|
|
|
node static/tests.js
|
|
|
|
|
2022-01-27 22:40:11 +00:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2022-01-24 21:41:07 +00:00
|
|
|
- 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 }}
|
|
|
|
|
2022-01-27 22:40:11 +00:00
|
|
|
- name: Setup Babashka
|
|
|
|
uses: turtlequeue/setup-babashka@v1.3.0
|
|
|
|
with:
|
|
|
|
babashka-version: ${{ env.BABASHKA_VERSION }}
|
|
|
|
|
2022-01-24 21:41:07 +00:00
|
|
|
- name: Run clj-kondo lint
|
|
|
|
run: clojure -M:clj-kondo --parallel --lint src
|
|
|
|
|
|
|
|
- name: Carve lint for unused vars
|
|
|
|
run: scripts/carve.clj
|
|
|
|
|
2022-02-04 18:52:46 +00:00
|
|
|
- name: Lint for vars that are too large
|
|
|
|
run: scripts/large_vars.clj
|
|
|
|
|
2022-02-02 16:26:20 +00:00
|
|
|
- name: Lint invalid translation entries
|
|
|
|
run: bb lang:invalid-translations
|
2022-01-27 22:40:11 +00:00
|
|
|
|
2022-03-08 17:21:50 +00:00
|
|
|
- name: Lint datalog rules
|
|
|
|
run: scripts/lint_rules.clj
|
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
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:
|
2022-01-13 03:57:51 +00:00
|
|
|
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
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- name: Set up Clojure
|
2020-11-23 08:48:04 +00:00
|
|
|
uses: DeLaGuardo/setup-clojure@master
|
|
|
|
with:
|
2021-04-08 17:15:54 +00:00
|
|
|
cli: ${{ env.CLOJURE_VERSION }}
|
2020-11-23 08:48:04 +00:00
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- name: Clojure cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: clojure-deps
|
2022-01-11 22:41:04 +00:00
|
|
|
with:
|
2022-01-13 03:57:51 +00:00
|
|
|
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
|
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- name: Shadow-cljs cache
|
|
|
|
uses: actions/cache@v2
|
2020-11-23 15:00:49 +00:00
|
|
|
with:
|
2022-01-13 03:57:51 +00:00
|
|
|
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: |
|
2022-01-13 03:57:51 +00:00
|
|
|
${{ runner.os }}-shadow-cljs-
|
2020-11-23 15:00:49 +00:00
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- name: Fetch yarn deps
|
|
|
|
run: yarn install
|
|
|
|
env:
|
|
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
|
2022-01-11 22:41:04 +00:00
|
|
|
|
2022-01-13 03:57:51 +00:00
|
|
|
- name: Prepare E2E test build
|
2020-11-23 15:00:49 +00:00
|
|
|
run: |
|
2022-01-13 03:57:51 +00:00
|
|
|
yarn gulp:build && yarn cljs:release
|
|
|
|
(cd static && yarn install && yarn rebuild:better-sqlite3)
|
2021-11-23 06:30:49 +00:00
|
|
|
|
2022-03-18 15:04:47 +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
|
|
|
|
|
2022-03-31 13:37:19 +00:00
|
|
|
# If not building, the `event_` of `goog.event.KeyboardEvent` would be missing
|
|
|
|
- name: Build app
|
|
|
|
run: clojure -M:cljs compile app
|
|
|
|
|
2021-11-23 06:30:49 +00:00
|
|
|
- name: Run Playwright test
|
2022-01-13 03:57:51 +00:00
|
|
|
run: xvfb-run -- yarn e2e-test
|
2021-11-23 06:30:49 +00:00
|
|
|
env:
|
2022-01-18 02:37:31 +00:00
|
|
|
CI: true
|
2021-11-23 06:30:49 +00:00
|
|
|
DEBUG: "pw:test"
|
|
|
|
|
|
|
|
- name: Save test artifacts
|
2022-01-13 03:57:51 +00:00
|
|
|
if: ${{ failure() }}
|
2021-11-23 06:30:49 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: e2e-test-report
|
|
|
|
path: artifacts.zip
|