Compare commits

..
3 changed files with 16 additions and 31 deletions

No files matched your search

@@ -1,15 +0,0 @@
name: Persistent build output
description: >-
On a self-hosted runner, point CARGO_TARGET_DIR at a directory outside the workspace
(checkout cleans ignored files) that persists between runs, in place of a restored cache.
Each runner (one job at a time) gets its own directory per job, so concurrent jobs never share one.
runs:
using: composite
steps:
- if: runner.environment == 'self-hosted'
shell: bash
run: |
dir="$HOME/.cache/openidea-ci/$RUNNER_NAME/target-$GITHUB_JOB"
# Start over once it grows past 60 GB.
if [ -d "$dir" ] && [ "$(du -sk "$dir" | cut -f1)" -gt 62914560 ]; then rm -rf "$dir"; fi
echo "CARGO_TARGET_DIR=$dir" >> "$GITHUB_ENV"
+11 -13
View File
@@ -69,15 +69,10 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
# Apple silicon like macos-latest; the self-hosted Mac keeps its build output between runs.
- { os: macos-latest, runner: [self-hosted, macOS, ARM64] }
- { os: ubuntu-22.04, runner: ubuntu-22.04 }
- { os: windows-latest, runner: windows-latest }
runs-on: ${{ matrix.runner }}
os: [macos-latest, ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/persistent-target
- uses: pnpm/action-setup@v5
with: { version: 11 }
- uses: actions/setup-node@v5
@@ -86,7 +81,6 @@ jobs:
with: { components: "clippy, rustfmt" }
# Only main saves the cache (saving takes minutes on Windows); PRs restore main's.
- uses: Swatinem/rust-cache@v2
if: runner.environment == 'github-hosted'
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: taiki-e/install-action@nextest
@@ -137,13 +131,18 @@ jobs:
needs: changes
if: needs.changes.outputs.rust == 'true'
timeout-minutes: 30
# Rust and Node only: the self-hosted Mac, building incrementally on its persisted output.
runs-on: [self-hosted, macOS, ARM64]
runs-on: ubuntu-22.04
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target-plugins
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/persistent-target
- uses: dtolnay/rust-toolchain@stable
with: { targets: wasm32-wasip2, components: "clippy, rustfmt" }
- uses: Swatinem/rust-cache@v2
with:
key: plugins
cache-directories: target-plugins
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Format, lint (host and wasm) and test each crate
shell: bash
run: |
@@ -196,8 +195,7 @@ jobs:
needs: changes
if: needs.changes.outputs.frontend == 'true'
timeout-minutes: 30
# Node only, nothing architecture- or distro-specific: the self-hosted Linux runner.
runs-on: [self-hosted, Linux, ARM64]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v5
+5 -3
View File
@@ -1062,11 +1062,13 @@ mod tests {
#[test]
fn a_child_inside_a_project_gets_its_environment() {
let root = std::path::Path::new("/openidea-test-process/project");
// Absolute on the platform: the search path drops relative entries.
let devshell = if cfg!(windows) { r"C:\nix\store\x-devshell\bin" } else { "/nix/store/x-devshell/bin" };
crate::project_env::set(
root,
vec![
("OPENIDEA_PROJECT_VAR".into(), Some("devshell".into())),
("PATH".into(), Some("/nix/store/x-devshell/bin".into())),
("PATH".into(), Some(devshell.into())),
("OPENIDEA_PROJECT_UNSET".into(), None),
],
);
@@ -1075,7 +1077,7 @@ mod tests {
let mut inside = Command::new("true");
inside.current_dir(root.join("src")).env("OPENIDEA_PROJECT_VAR", "call site");
host_env(&mut inside);
assert_eq!(get(&inside, "PATH"), Some(Some("/nix/store/x-devshell/bin".into())));
assert_eq!(get(&inside, "PATH"), Some(Some(devshell.into())));
assert_eq!(get(&inside, "OPENIDEA_PROJECT_UNSET"), Some(None));
assert_eq!(get(&inside, "OPENIDEA_PROJECT_VAR"), Some(Some("call site".into())), "the call site's value wins");
@@ -1093,7 +1095,7 @@ mod tests {
assert_eq!(host_var_os_in(root, "OPENIDEA_PROJECT_VAR"), Some("devshell".into()));
assert_eq!(host_var_os("OPENIDEA_PROJECT_VAR"), None);
let search = crate::tool_path::search_path_in(root);
assert_eq!(std::env::split_paths(&search).next(), Some("/nix/store/x-devshell/bin".into()));
assert_eq!(std::env::split_paths(&search).next(), Some(devshell.into()));
crate::project_env::remove(root);
assert!(host_vars_in(root).all(|(k, _)| k != "OPENIDEA_PROJECT_VAR"));
}