Update Github Actions CI set-env/add-path (#2265)

In accordance with [this
advisory](https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/)
it's recommended we moved to a different scheme of setting env vars and
updating PATH.
This commit is contained in:
Alex Crichton
2020-10-05 15:08:56 -05:00
committed by GitHub
parent 9e87e45745
commit e22e2c3722
4 changed files with 42 additions and 26 deletions

View File

@@ -1,10 +1,15 @@
const child_process = require('child_process');
const toolchain = process.env.INPUT_TOOLCHAIN;
const fs = require('fs');
function set_env(name, val) {
fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`)
}
if (process.platform === 'darwin') {
child_process.execSync(`curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=none --profile=minimal`);
const bindir = `${process.env.HOME}/.cargo/bin`;
console.log(`::add-path::${bindir}`);
fs.appendFileSync(process.env['GITHUB_PATH'], `${bindir}\n`);
process.env.PATH = `${process.env.PATH}:${bindir}`;
}
@@ -15,13 +20,13 @@ child_process.execFileSync('rustup', ['default', toolchain]);
// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't
// do this on nightly though since there's a fair amount of warning churn there.
if (!toolchain.startsWith('nightly')) {
console.log(`::set-env name=RUSTFLAGS::-D warnings`);
set_env("RUSTFLAGS", "-D warnings");
}
// Save disk space by avoiding incremental compilation, and also we don't use
// any caching so incremental wouldn't help anyway.
console.log(`::set-env name=CARGO_INCREMENTAL::0`);
set_env("CARGO_INCREMENTAL", "0");
// Turn down debuginfo from 2 to 1 to help save disk space
console.log(`::set-env name=CARGO_PROFILE_DEV_DEBUG::1`);
console.log(`::set-env name=CARGO_PROFILE_TEST_DEBUG::1`);
set_env("CARGO_PROFILE_DEV_DEBUG", "1");
set_env("CARGO_PROFILE_TEST_DEBUG", "1");