From d70a4279cf2295ba23e1ccee8456f86c60f54cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 16 Aug 2019 02:16:04 +0200 Subject: [PATCH] Clean up in general --- .github/workflows/integration.yml | 4 ++-- README.md | 4 ++-- src/main.ts | 2 +- src/rustup.ts | 23 +++++++---------------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7846da3..90d3588 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,4 +1,4 @@ -name: Integration test +name: Integration on: [push] jobs: @@ -7,7 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - rust: [stable, beta, nightly] + rust: [stable, nightly] steps: - uses: hecrj/setup-rust-action@master with: diff --git a/README.md b/README.md index 0be3f72..6beebad 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # setup-rust-action -[![Integration test status](https://github.com/hecrj/setup-rust-action/workflows/Integration%20test/badge.svg)](https://github.com/hecrj/setup-rust-action/actions) +[![Integration status](https://github.com/hecrj/setup-rust-action/workflows/Integration/badge.svg)](https://github.com/hecrj/setup-rust-action/actions) Sets up a specific Rust toolchain for use in your GitHub Actions workflows. @@ -12,7 +12,7 @@ You can combine it with `matrix` to test different Rust toolchains in different platforms! ```yml -name: Test +name: Test Rust project on: [push] jobs: test: diff --git a/src/main.ts b/src/main.ts index 2b1852a..3b626b2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,7 @@ async function run() { const version = core.getInput('rust-version'); if(version) { - await rustup.install(version); + await rustup.install(); await exec.exec('rustup', ['default', version]); await exec.exec('rustup', ['update', version]); } diff --git a/src/rustup.ts b/src/rustup.ts index 3b88847..125a10f 100644 --- a/src/rustup.ts +++ b/src/rustup.ts @@ -8,30 +8,21 @@ import {chmodSync} from 'fs'; let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || ''; -export async function install(version: string) { +export async function install() { + // `rustup` is already installed in if (os.platform() == 'darwin') { - let toolPath = await acquireRust(version); - - core.debug('Rust toolchain is cached under ' + toolPath); + let toolPath = await installOnUnix(); + core.debug('rustup is located under: ' + toolPath); core.addPath(path.join(toolPath, 'bin')); } } -async function acquireRust(version: string): Promise { - let script: string; - - try { - script = await toolCache.downloadTool("https://sh.rustup.rs"); - } catch (error) { - core.debug(error); - throw `Failed to download rustup: ${error}`; - } +async function installOnUnix(): Promise { + let script = await toolCache.downloadTool("https://sh.rustup.rs"); chmodSync(script, '777'); await exec.exec(`"${script}"`, ['-y', '--default-toolchain', 'none']); - let cargo = path.join(process.env['HOME'] || '', '.cargo'); - - return await toolCache.cacheDir(cargo, 'rust', version); + return path.join(process.env['HOME'] || '', '.cargo'); }