WIP serving local fonts #845
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: "Editor: Dev & CI" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: self-hosted | |
permissions: | |
contents: read | |
deployments: write | |
pull-requests: write | |
env: | |
RUSTC_WRAPPER: /usr/bin/sccache | |
CARGO_INCREMENTAL: 0 | |
SCCACHE_DIR: /var/lib/github-actions/.cache | |
steps: | |
- name: 📥 Clone and checkout repository | |
uses: actions/checkout@v3 | |
- name: 🗑 Clear wasm-bindgen cache | |
run: rm -r ~/.cache/.wasm-pack || true | |
- name: 🟢 Install the latest Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "latest" | |
- name: 🚧 Install Node dependencies | |
run: | | |
cd frontend | |
npm ci | |
- name: 🦀 Install the latest Rust | |
run: | | |
echo "Initial system version:" | |
rustc --version | |
rustup update stable | |
echo "Latest updated version:" | |
rustc --version | |
- name: ✂ Replace template in <head> of index.html | |
run: | | |
# Check if we are on the master branch | |
if git rev-parse --abbrev-ref HEAD | grep master > /dev/null; then | |
export INDEX_HTML_HEAD_SCRIPT=$(curl -s https://graphite.rs/visit/script.hash.js) || exit 1 | |
export INDEX_HTML_HEAD_REPLACEMENT="<script data-domain=\"dev.graphite.rs\" data-api=\"https://graphite.rs/visit/event\">$INDEX_HTML_HEAD_SCRIPT</script>" | |
else | |
export INDEX_HTML_HEAD_REPLACEMENT="" | |
fi | |
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html | |
- name: 🌐 Build Graphite web code | |
env: | |
NODE_ENV: production | |
run: | | |
cd frontend | |
mold -run npm run build | |
- name: 📤 Publish to Cloudflare Pages | |
id: cloudflare | |
uses: cloudflare/pages-action@1 | |
continue-on-error: true | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectName: graphite-dev | |
directory: frontend/dist | |
- name: 👕 Lint Graphite web formatting | |
env: | |
NODE_ENV: production | |
run: | | |
cd frontend | |
npm run lint | |
- name: 🔬 Check Rust formatting | |
run: | | |
mold -run cargo fmt --all -- --check | |
- name: 🦀 Build Rust code | |
run: | | |
mold -run cargo build --all-features | |
- name: 🧪 Run Rust tests | |
run: | | |
mold -run cargo test --all-features | |
# miri: | |
# runs-on: self-hosted | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: 🧪 Run Rust miri | |
# run: | | |
# mold -run cargo +nightly miri nextest run -j32 --all-features | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Clone and checkout repository | |
uses: actions/checkout@v3 | |
- name: 🔒 Check crate security advisories for root workspace | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check advisories | |
- name: 🔒 Check crate security advisories for /libraries/rawkit | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check advisories | |
manifest-path: libraries/rawkit/Cargo.toml | |
- name: 📜 Check crate license compatibility for root workspace | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check bans licenses sources | |
- name: 📜 Check crate license compatibility for /libraries/rawkit | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check bans licenses sources | |
manifest-path: libraries/rawkit/Cargo.toml |