Merge pull request #5 from softprops/add-targets
add support for adding rustup targets
This commit is contained in:
commit
7dde178219
10
.github/workflows/integration.yml
vendored
10
.github/workflows/integration.yml
vendored
@ -14,11 +14,21 @@ jobs:
|
|||||||
- os: macOS-latest
|
- os: macOS-latest
|
||||||
rust: 'stable'
|
rust: 'stable'
|
||||||
components: 'rustfmt, clippy'
|
components: 'rustfmt, clippy'
|
||||||
|
targets: 'x86_64-apple-darwin'
|
||||||
|
- os: windows-latest
|
||||||
|
rust: 'stable'
|
||||||
|
components: 'rustfmt, clippy'
|
||||||
|
targets: 'x86_64-pc-windows-msvc'
|
||||||
|
- os: ubuntu-latest
|
||||||
|
rust: 'stable'
|
||||||
|
components: 'rustfmt, clippy'
|
||||||
|
targets: 'x86_64-unknown-linux-musl'
|
||||||
steps:
|
steps:
|
||||||
- uses: hecrj/setup-rust-action@master
|
- uses: hecrj/setup-rust-action@master
|
||||||
with:
|
with:
|
||||||
rust-version: ${{ matrix.rust }}
|
rust-version: ${{ matrix.rust }}
|
||||||
components: ${{ matrix.components || '' }}
|
components: ${{ matrix.components || '' }}
|
||||||
|
targets: ${{ matrix.targets || '' }}
|
||||||
- name: Check Cargo availability
|
- name: Check Cargo availability
|
||||||
run: cargo --version
|
run: cargo --version
|
||||||
- name: Check Rustup default toolchain
|
- name: Check Rustup default toolchain
|
||||||
|
@ -8,6 +8,9 @@ inputs:
|
|||||||
components:
|
components:
|
||||||
description: 'The toolchain components to install, comma-separated'
|
description: 'The toolchain components to install, comma-separated'
|
||||||
default: ''
|
default: ''
|
||||||
|
targets:
|
||||||
|
description: 'The toolchain targets to add, comma-separated'
|
||||||
|
default: ''
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/main.js'
|
main: 'lib/main.js'
|
||||||
|
@ -26,6 +26,10 @@ function run() {
|
|||||||
.split(',')
|
.split(',')
|
||||||
.map((component) => component.trim())
|
.map((component) => component.trim())
|
||||||
.filter((component) => component.length > 0);
|
.filter((component) => component.length > 0);
|
||||||
|
const targets = core.getInput('targets')
|
||||||
|
.split(',')
|
||||||
|
.map((target) => target.trim())
|
||||||
|
.filter((target) => target.length > 0);
|
||||||
if (version) {
|
if (version) {
|
||||||
yield rustup.install();
|
yield rustup.install();
|
||||||
yield exec.exec('rustup', ['default', version]);
|
yield exec.exec('rustup', ['default', version]);
|
||||||
@ -33,6 +37,9 @@ function run() {
|
|||||||
for (let component of components) {
|
for (let component of components) {
|
||||||
yield exec.exec('rustup', ['component', 'add', component]);
|
yield exec.exec('rustup', ['component', 'add', component]);
|
||||||
}
|
}
|
||||||
|
for (let target of targets) {
|
||||||
|
yield exec.exec('rustup', ['target', 'add', target]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "node12-template-action",
|
"name": "setup-rust-action",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
@ -10,6 +10,10 @@ async function run() {
|
|||||||
.split(',')
|
.split(',')
|
||||||
.map((component) => component.trim())
|
.map((component) => component.trim())
|
||||||
.filter((component) => component.length > 0);
|
.filter((component) => component.length > 0);
|
||||||
|
const targets = core.getInput('targets')
|
||||||
|
.split(',')
|
||||||
|
.map((target) => target.trim())
|
||||||
|
.filter((target) => target.length > 0);
|
||||||
|
|
||||||
if(version) {
|
if(version) {
|
||||||
await rustup.install();
|
await rustup.install();
|
||||||
@ -19,6 +23,10 @@ async function run() {
|
|||||||
for(let component of components) {
|
for(let component of components) {
|
||||||
await exec.exec('rustup', ['component', 'add', component]);
|
await exec.exec('rustup', ['component', 'add', component]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(let target of targets) {
|
||||||
|
await exec.exec('rustup', ['target', 'add', target]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
Loading…
Reference in New Issue
Block a user