build-web #1
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: build-web | |
on: | |
workflow_call: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
CLICOLOR_FORCE: 1 | |
RUSTFLAGS: "-C debuginfo=0" | |
RUSTDOCFLAGS: "-Dwarnings" | |
jobs: | |
build-web: | |
runs-on: ubuntu-latest | |
# Skip running workflow on forks. Checking the repository owner still allows | |
# this to be run on PRs, and then below we disable it from attempting to | |
# publish. | |
if: github.repository_owner == 'prql' | |
steps: | |
- name: 📂 Checkout code | |
uses: actions/checkout@v4 | |
# Website requires Hugo | |
- name: Setup Hugo | |
uses: peaceiris/[email protected] | |
- uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: mdbook | |
- uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: mdbook-footnote | |
- uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: mdbook-admonish | |
- uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: wasm-pack | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- run: ./.github/workflows/scripts/set_version.sh | |
- name: 💰 Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: ${{ env.version }} | |
shared-key: web | |
save-if: | |
${{ github.ref == 'refs/heads/web' || github.ref == | |
'refs/heads/main' }} | |
- uses: arduino/setup-task@v2 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: 🕷️ Build web | |
run: task web:build | |
- uses: actions/[email protected] | |
with: | |
path: web/website/public/ | |
build-codemirror-demo: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'prql' | |
steps: | |
- name: 📂 Checkout code | |
uses: actions/checkout@v4 | |
- name: 🧅 Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Install CodeMirror demo dependencies | |
working-directory: web/prql-codemirror-demo/ | |
run: bun install | |
- name: Install Lezer dependencies | |
working-directory: grammars/prql-lezer/ | |
run: bun install | |
- name: Build Lezer grammar | |
working-directory: grammars/prql-lezer/ | |
run: bun run build | |
- name: Copy Lezer grammar into demo | |
working-directory: web/prql-codemirror-demo/ | |
run: | | |
mkdir src/lang-prql/prql-lezer | |
cp ../../grammars/prql-lezer/dist/* src/lang-prql/prql-lezer/ | |
- name: Build CodeMirror demo | |
working-directory: web/prql-codemirror-demo/ | |
run: bun run build |