diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index bcb539f..3fc5463 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -14,11 +14,21 @@ jobs: - os: macOS-latest rust: 'stable' 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: - uses: hecrj/setup-rust-action@master with: rust-version: ${{ matrix.rust }} components: ${{ matrix.components || '' }} + targets: ${{ matrix.targets || '' }} - name: Check Cargo availability run: cargo --version - name: Check Rustup default toolchain diff --git a/action.yml b/action.yml index 8423267..4a9b3fd 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,9 @@ inputs: components: description: 'The toolchain components to install, comma-separated' default: '' + targets: + description: 'The toolchain targets to add, comma-separated' + default: '' runs: using: 'node12' main: 'lib/main.js' diff --git a/lib/main.js b/lib/main.js index e9543ff..b7cf884 100644 --- a/lib/main.js +++ b/lib/main.js @@ -26,6 +26,10 @@ function run() { .split(',') .map((component) => component.trim()) .filter((component) => component.length > 0); + const targets = core.getInput('targets') + .split(',') + .map((target) => target.trim()) + .filter((target) => target.length > 0); if (version) { yield rustup.install(); yield exec.exec('rustup', ['default', version]); @@ -33,6 +37,9 @@ function run() { for (let component of components) { yield exec.exec('rustup', ['component', 'add', component]); } + for (let target of targets) { + yield exec.exec('rustup', ['target', 'add', target]); + } } } catch (error) { diff --git a/package-lock.json b/package-lock.json index 64e9faa..59e4a7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "node12-template-action", + "name": "setup-rust-action", "version": "0.0.0", "lockfileVersion": 1, "requires": true, diff --git a/src/main.ts b/src/main.ts index d3b4159..0d4db90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,6 +10,10 @@ async function run() { .split(',') .map((component) => component.trim()) .filter((component) => component.length > 0); + const targets = core.getInput('targets') + .split(',') + .map((target) => target.trim()) + .filter((target) => target.length > 0); if(version) { await rustup.install(); @@ -19,6 +23,10 @@ async function run() { for(let component of components) { await exec.exec('rustup', ['component', 'add', component]); } + + for(let target of targets) { + await exec.exec('rustup', ['target', 'add', target]); + } } } catch (error) { core.setFailed(error.message);