Replace self-hosted runner with GH-provided runner #191
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 | |
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script> | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
pull-requests: write | |
steps: | |
- name: 📥 Clone and checkout repository | |
uses: actions/checkout@v3 | |
- 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: 📜 Install Rust dependencies | |
run: | | |
cargo install cargo-about | |
cargo install cargo-watch | |
cargo install wasm-pack | |
cargo install -f wasm-bindgen-cli@0.2.92 | |
- name: 📦 Install system dependencies | |
run: | | |
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev | |
- name: ✂ Replace template in <head> of index.html | |
run: | | |
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys) | |
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT="" | |
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 | |
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: | | |
cargo fmt --all -- --check | |
- name: 🦀 Build Rust code | |
run: | | |
cargo build --all-features | |
- name: 🧪 Run Rust tests | |
run: | | |
cargo test --all-features | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Clone and checkout repository | |
uses: actions/checkout@v3 | |
- name: 🔒 Check crate security advisories | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
command: check advisories | |
- name: 📜 Check crate license compatibility | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
command: check bans licenses sources |