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