Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace self-hosted runner with GH-provided runner #2019

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions .github/workflows/build-dev-and-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ env:

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest
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 system dependencies
run: |
sudo apt update
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev

- name: 🟢 Install the latest Node.js
uses: actions/setup-node@v4
Expand All @@ -48,6 +46,16 @@ jobs:
echo "Latest updated version:"
rustc --version

- name: 📜 Prepare to install Rust dependencies
uses: cargo-bins/cargo-binstall@main

- name: 📜 Install Rust dependencies
run: |
cargo binstall --no-confirm cargo-about
cargo binstall --no-confirm cargo-watch
cargo binstall --no-confirm wasm-pack
cargo binstall --no-confirm [email protected]

- name: ✂ Replace template in <head> of index.html
run: |
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
Expand All @@ -59,7 +67,7 @@ jobs:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
PATH=~/.cargo/bin:$PATH npm run build

- name: 📤 Publish to Cloudflare Pages
id: cloudflare
Expand All @@ -81,25 +89,15 @@ jobs:

- name: 🔬 Check Rust formatting
run: |
mold -run cargo fmt --all -- --check
cargo fmt --all -- --check

- name: 🦀 Build Rust code
run: |
mold -run cargo build --all-features
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 test --all-features

cargo-deny:
runs-on: ubuntu-latest
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/build-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@ on:

env:
CARGO_TERM_COLOR: always
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest
permissions:
contents: write
deployments: write
env:
RUSTC_WRAPPER: /usr/bin/sccache
CARGO_INCREMENTAL: 0
SCCACHE_DIR: /var/lib/github-actions/.cache
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>

steps:
- name: 📥 Clone and checkout repository
uses: actions/checkout@v3

- name: 🗑 Clear wasm-bindgen cache
run: rm -r ~/.cache/.wasm-pack
- name: 📦 Install system dependencies
run: |
sudo apt update
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev

- name: 🟢 Install the latest Node.js
uses: actions/setup-node@v4
Expand All @@ -45,6 +43,16 @@ jobs:
echo "Latest updated version:"
rustc --version

- name: 📜 Prepare to install Rust dependencies
uses: cargo-bins/cargo-binstall@main

- name: 📜 Install Rust dependencies
run: |
cargo binstall --no-confirm cargo-about
cargo binstall --no-confirm cargo-watch
cargo binstall --no-confirm wasm-pack
cargo binstall --no-confirm [email protected]

- name: ✂ Replace template in <head> of index.html
run: |
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
Expand All @@ -54,7 +62,7 @@ jobs:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
PATH=~/.cargo/bin:$PATH npm run build

- name: 📤 Publish to Cloudflare Pages
id: cloudflare
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/comment-!build-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ jobs:
github.event.issue.pull_request &&
github.event.comment.author_association == 'MEMBER' &&
(github.event.comment.body == '!build-dev' || github.event.comment.body == '!build-profiling' || github.event.comment.body == '!build')
runs-on: self-hosted
runs-on: ubuntu-latest
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: 🔎 Find branch for this PR
Expand All @@ -50,9 +46,10 @@ jobs:
repository: ${{ steps.commit_info.outputs.repo }}
ref: ${{ steps.commit_info.outputs.ref }}

- name: 🗑 Clear wasm-bindgen cache
continue-on-error: true
run: rm -r ~/.cache/.wasm-pack
- name: 📦 Install system dependencies
run: |
sudo apt update
sudo apt install libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev

- name: 🟢 Install the latest Node.js
uses: actions/setup-node@v4
Expand All @@ -72,6 +69,16 @@ jobs:
echo "Latest updated version:"
rustc --version

- name: 📜 Prepare to install Rust dependencies
uses: cargo-bins/cargo-binstall@main

- name: 📜 Install Rust dependencies
run: |
cargo binstall --no-confirm cargo-about
cargo binstall --no-confirm cargo-watch
cargo binstall --no-confirm wasm-pack
cargo binstall --no-confirm [email protected]

- name: ✂ Replace template in <head> of index.html
run: |
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
Expand All @@ -96,7 +103,7 @@ jobs:
NODE_ENV: production
run: |
cd frontend
mold -run npm run ${{ steps.build_command.outputs.command }}
PATH=~/.cargo/bin:$PATH npm run ${{ steps.build_command.outputs.command }}

- name: 📤 Publish to Cloudflare Pages
id: cloudflare
Expand Down
8 changes: 3 additions & 5 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,18 @@ function generateRustLicenses(): LicenseInfo[] | undefined {
try {
// Call `cargo about` in the terminal to generate the license information for Rust crates.
// The `about.hbs` file is written so it generates a valid JavaScript array expression which we evaluate below.
const { stdout, stderr, status } = spawnSync("cargo", ["about", "generate", "about.hbs"], {
const { stdout, stderr, status, error } = spawnSync("cargo", ["about", "generate", "about.hbs"], {
cwd: path.join(__dirname, ".."),
encoding: "utf8",
timeout: 60000, // One minute
timeout: 5 * 60000, // Five minutes
shell: true,
windowsHide: true, // Hide the terminal on Windows
});

// If the command failed, print the error message and exit early.
if (status !== 0) {
// Cargo returns 101 when the subcommand (`about`) wasn't found, so we skip printing the below error message in that case.
if (status !== 101) {
console.error("cargo-about failed", status, stderr);
}
if (status !== 101) console.error("cargo-about failed.\n", "Status: ", status, "Error: ", error, "\nstderr:", stderr);
return undefined;
}

Expand Down
Loading