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]
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:

View File

@ -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:

View File

@ -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]);
}

View File

@ -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<string> {
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<string> {
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');
}