Clean up in general

This commit is contained in:
Héctor Ramón Jiménez 2019-08-16 02:16:04 +02:00
parent b6def3913c
commit d70a4279cf
4 changed files with 12 additions and 21 deletions

View File

@ -1,4 +1,4 @@
name: Integration test name: Integration
on: [push] on: [push]
jobs: jobs:
@ -7,7 +7,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable, beta, nightly] rust: [stable, nightly]
steps: steps:
- uses: hecrj/setup-rust-action@master - uses: hecrj/setup-rust-action@master
with: with:

View File

@ -1,6 +1,6 @@
# setup-rust-action # 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. 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! platforms!
```yml ```yml
name: Test name: Test Rust project
on: [push] on: [push]
jobs: jobs:
test: test:

View File

@ -8,7 +8,7 @@ async function run() {
const version = core.getInput('rust-version'); const version = core.getInput('rust-version');
if(version) { if(version) {
await rustup.install(version); await rustup.install();
await exec.exec('rustup', ['default', version]); await exec.exec('rustup', ['default', version]);
await exec.exec('rustup', ['update', version]); await exec.exec('rustup', ['update', version]);
} }

View File

@ -8,30 +8,21 @@ import {chmodSync} from 'fs';
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || ''; 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') { if (os.platform() == 'darwin') {
let toolPath = await acquireRust(version); let toolPath = await installOnUnix();
core.debug('Rust toolchain is cached under ' + toolPath);
core.debug('rustup is located under: ' + toolPath);
core.addPath(path.join(toolPath, 'bin')); core.addPath(path.join(toolPath, 'bin'));
} }
} }
async function acquireRust(version: string): Promise<string> { async function installOnUnix(): Promise<string> {
let script: string; let script = await toolCache.downloadTool("https://sh.rustup.rs");
try {
script = await toolCache.downloadTool("https://sh.rustup.rs");
} catch (error) {
core.debug(error);
throw `Failed to download rustup: ${error}`;
}
chmodSync(script, '777'); chmodSync(script, '777');
await exec.exec(`"${script}"`, ['-y', '--default-toolchain', 'none']); await exec.exec(`"${script}"`, ['-y', '--default-toolchain', 'none']);
let cargo = path.join(process.env['HOME'] || '', '.cargo'); return path.join(process.env['HOME'] || '', '.cargo');
return await toolCache.cacheDir(cargo, 'rust', version);
} }