diff --git a/.github/actions/install-rust/README.md b/.github/actions/install-rust/README.md index e90a00f4..df8e94dc 100644 --- a/.github/actions/install-rust/README.md +++ b/.github/actions/install-rust/README.md @@ -1,7 +1,5 @@ # install-rust -Author: Alex Crichton - A small github action to install `rustup` and a Rust toolchain. This is generally expressed inline, but it was repeated enough in this repository it seemed worthwhile to extract. @@ -17,4 +15,4 @@ When the above are fixed we should delete this action and just use this inline: ```yml - run: rustup update $toolchain && rustup default $toolchain shell: bash -``` \ No newline at end of file +``` diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml index d82fe182..7a196591 100644 --- a/.github/actions/install-rust/action.yml +++ b/.github/actions/install-rust/action.yml @@ -1,4 +1,3 @@ -# Author: Alex Crichton name: 'Install Rust toolchain' description: 'Install both `rustup` and a Rust toolchain' @@ -10,4 +9,4 @@ inputs: runs: using: node12 - main: 'main.js' \ No newline at end of file + main: 'main.js' diff --git a/.github/actions/install-rust/main.js b/.github/actions/install-rust/main.js index f464bbab..9f16b818 100644 --- a/.github/actions/install-rust/main.js +++ b/.github/actions/install-rust/main.js @@ -1,11 +1,15 @@ -// Author: Alex Crichton 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}`; } @@ -16,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`); \ No newline at end of file +set_env("CARGO_PROFILE_DEV_DEBUG", "1"); +set_env("CARGO_PROFILE_TEST_DEBUG", "1"); diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb051dcf..f2f3aff3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: submodules: true - uses: ./.github/actions/install-rust @@ -37,7 +37,7 @@ jobs: rust: nightly steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: submodules: true - uses: ./.github/actions/install-rust @@ -81,7 +81,7 @@ jobs: rust: nightly steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: submodules: true - uses: ./.github/actions/install-rust