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. 21if (!toolchain.startsWith('nightly')) { 22 set_env("RUSTFLAGS", "-D warnings"); 23} 24 25// Save disk space by avoiding incremental compilation, and also we don't use 26// any caching so incremental wouldn't help anyway. 27set_env("CARGO_INCREMENTAL", "0"); 28 29// Turn down debuginfo from 2 to 1 to help save disk space 30set_env("CARGO_PROFILE_DEV_DEBUG", "1"); 31set_env("CARGO_PROFILE_TEST_DEBUG", "1"); 32 33if (process.platform === 'darwin') { 34 set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked"); 35 set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked"); 36} 37