Debian Codegraph @

debian/missing-sources/target-lexicon/.github/actions/install-rust/main.js

raw
1 const child_process = require('child_process');
2 const toolchain = process.env.INPUT_TOOLCHAIN;
3 const fs = require('fs');
4
5 function 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.
11 if (process.platform === 'win32') {
12 child_process.execFileSync('rustup', ['self', 'update']);
13 }
14
15 child_process.execFileSync('rustup', ['set', 'profile', 'minimal']);
16 child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']);
17 child_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 //
22 // Disable this for now to avoid `unexpected_cfgs` in a way that works with
23 // Rust 1.34.
24 //if (!toolchain.startsWith('nightly')) {
25 // set_env("RUSTFLAGS", "-D warnings");
26 //}
27
28 // Save disk space by avoiding incremental compilation, and also we don't use
29 // any caching so incremental wouldn't help anyway.
30 set_env("CARGO_INCREMENTAL", "0");
31
32 // Turn down debuginfo from 2 to 1 to help save disk space
33 set_env("CARGO_PROFILE_DEV_DEBUG", "1");
34 set_env("CARGO_PROFILE_TEST_DEBUG", "1");
35
36 if (process.platform === 'darwin') {
37 set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked");
38 set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked");
39 }