Fix #718: expose spec #5352
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Delivery | |
on: push | |
jobs: | |
build-and-upload-viewer-resources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 🔧 Install java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11.0.7' | |
cache: 'maven' | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: '1.10.3.943' | |
bb: latest | |
clj-kondo: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-build-viewer-${{ hashFiles('deps.edn') }} | |
- name: Build and upload viewer resources | |
env: | |
GITHUB_TOKEN: ${{ secrets.CAS_AUTH_TOKEN }} | |
run: bb build+upload-viewer-resources | |
clj-kondo: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
bb: latest | |
clj-kondo: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-lint-${{ hashFiles('bb.edn') }} | |
- name: Run clj-kondo linter | |
run: bb lint | |
test: | |
runs-on: ${{matrix.sys.os}} | |
strategy: | |
matrix: | |
sys: | |
- { os: macos-latest, shell: bash } | |
- { os: ubuntu-latest, shell: bash } | |
- { os: windows-latest, shell: powershell } | |
defaults: | |
run: | |
shell: ${{matrix.sys.shell}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 🔧 Install java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11.0.7' | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: '1.10.3.943' | |
bb: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-test-${{ hashFiles('deps.edn') }} | |
- name: 🧪 Run tests | |
run: bb test:clj :kaocha/reporter '[kaocha.report/documentation]' | |
static-build: | |
runs-on: ubuntu-latest | |
needs: [build-and-upload-viewer-resources] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🔧 Install java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11.0.7' | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: '1.10.3.943' | |
bb: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-build-${{ hashFiles('deps.edn') }} | |
- name: 🗝 Clerk Cache | |
uses: actions/cache@v2 | |
with: | |
path: .clerk | |
key: ${{ runner.os }}-clerk-cache | |
- name: 🔐 Google Auth | |
uses: google-github-actions/[email protected] | |
with: | |
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }} | |
- name: 🔧 Setup Google Cloud SDK | |
uses: google-github-actions/[email protected] | |
- name: 📓 Build Clerk Book | |
run: | | |
cp notebooks/editor.clj editor.clj | |
clojure -J-Dclojure.main.report=stderr -X:demo:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :paths '["book.clj" "CHANGELOG.md" "editor.clj"]' | |
- name: 📠 Copy book to bucket under SHA | |
run: | | |
gsutil cp -r public/build gs://nextjournal-snapshots/clerk/book/${{ github.sha }} | |
- name: 🏗 Build Clerk Static App with default Notebooks | |
run: clojure -J-Dclojure.main.report=stderr -X:demo:nextjournal/clerk :package :single-file | |
- name: 📠 Copy static build to bucket under SHA | |
run: | | |
gsutil cp -r public/build gs://nextjournal-snapshots/clerk/build/${{ github.sha }} | |
- name: ✅ Add success status to report with link to snapshot | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'Continuous Delivery / Static App' | |
description: 'Ready' | |
state: 'success' | |
sha: ${{github.event.pull_request.head.sha || github.sha}} | |
target_url: https://snapshots.nextjournal.com/clerk/build/${{ github.sha }} | |
ssr: | |
name: SSR smoke test build | |
runs-on: ubuntu-latest | |
needs: [build-and-upload-viewer-resources] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🔧 Install java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11.0.7' | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: '1.10.3.943' | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-ssr-${{ hashFiles('deps.edn') }} | |
- name: 🎨 Setup Tailwindcss | |
run: yarn global add tailwindcss @tailwindcss/typography | |
- name: 🧶 Yarn Global | |
run: echo $(yarn global dir)/node_modules | |
- name: 🧪 Build Rule 30 Notebook with SSR | |
run: NODE_PATH=$(yarn global dir)/node_modules clojure -J-Dclojure.main.report=stdout -X:demo:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :index '"notebooks/rule_30.clj"' :paths [] :ssr true :compile-css true :exclude-js true | |
- name: 🔐 Google Auth | |
uses: google-github-actions/[email protected] | |
with: | |
credentials_json: ${{ secrets.GCLOUD_SERVICE_KEY }} | |
- name: 🔧 Setup Google Cloud SDK | |
uses: google-github-actions/[email protected] | |
- name: 📠 Copy SSR static build to bucket under SHA | |
run: | | |
gsutil cp -r public/build gs://nextjournal-snapshots/clerk-ssr/build/${{ github.sha }} | |
- name: ✅ Add success status to report with link to ssr snapshot | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{secrets.GITHUB_TOKEN}} | |
context: 'Continuous Delivery / SSR Static App' | |
description: 'Ready' | |
state: 'success' | |
sha: ${{github.event.pull_request.head.sha || github.sha}} | |
target_url: https://snapshots.nextjournal.com/clerk-ssr/build/${{ github.sha }} | |
ui-tests: | |
needs: [static-build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
bb: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-ui-tests-${{ hashFiles('deps.edn') }} | |
- name: Get installed playwright version | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=$(bb playwright:version)" >> "$GITHUB_ENV" | |
- name: Cache playwright binaries | |
uses: actions/cache@v4 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-npx-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- name: yarn install | |
run: cd ui_tests; yarn install | |
- name: playwright install | |
run: bb playwright:install | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Run Playwright tests against static assets | |
run: | | |
bb test:static-app :sha ${{ github.sha }} :skip-install true | |
bb test:static-app :skip-install true :url https://snapshots.nextjournal.com/clerk/book/${{ github.sha }}/book/index.html :index false :selector "span:has-text(\"Book of Clerk\")" | |
deploy: | |
needs: [build-and-upload-viewer-resources, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🔧 Install clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
bb: latest | |
- name: 🗝 maven cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2 | |
~/.gitlibs | |
~/.deps.clj | |
key: ${{ runner.os }}-maven-deploy-${{ hashFiles('deps.edn') }} | |
- name: Install SSH key and start ssh-agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.NEXTJOURNAL_CI_SSH_KEY }} | |
- name: Publish to clojars | |
env: | |
CLOJARS_USERNAME: mkvlr | |
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD_MKVLR }} | |
run: | | |
bb ci:publish | |
- name: Clerk version | |
id: clerk-version | |
run: | | |
CLERK_VERSION=$(bb clerk-version) | |
echo "##[set-output name=version;]${CLERK_VERSION}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: clerk-${{ steps.clerk-version.outputs.version }}.jar | |
path: target/clerk-${{ steps.clerk-version.outputs.version }}.jar |