• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const child_process = require('child_process');
2const toolchain = process.env.INPUT_TOOLCHAIN;
3const fs = require('fs');
4
5function set_env(name, val) {
6  fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`)
7}
8
9// Needed for now to get 1.24.2 which fixes a bug in 1.24.1 that causes issues
10// on Windows.
11if (process.platform === 'win32') {
12  child_process.execFileSync('rustup', ['self', 'update']);
13}
14
15child_process.execFileSync('rustup', ['set', 'profile', 'minimal']);
16child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']);
17child_process.execFileSync('rustup', ['default', toolchain]);
18
19// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't
20// do this on nightly though since there's a fair amount of warning churn there.
21// RUSTIX: Disable this so that it doesn't overwrite RUSTFLAGS for setting
22// "--cfg rustix_use_libc". We re-add it manually in the workflow.
23//if (!toolchain.startsWith('nightly')) {
24//  set_env("RUSTFLAGS", "-D warnings");
25//}
26
27// Save disk space by avoiding incremental compilation, and also we don't use
28// any caching so incremental wouldn't help anyway.
29set_env("CARGO_INCREMENTAL", "0");
30
31// Turn down debuginfo from 2 to 1 to help save disk space
32set_env("CARGO_PROFILE_DEV_DEBUG", "1");
33set_env("CARGO_PROFILE_TEST_DEBUG", "1");
34
35if (process.platform === 'darwin') {
36  set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked");
37  set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked");
38}
39