diff --git a/README.md b/README.md index 145425b..2549ccd 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ jobs: uses: actions-rs/tarpaulin@v0.1 with: version: '0.15.0' + target: 'x86_64-unknown-linux-gnu' args: '-- --test-threads 1' - name: Upload to codecov.io @@ -52,6 +53,7 @@ See [additional recipes here](https://github.com/actions-rs/meta). | Name | Required | Description | Type | Default | | ------------| :------: | ---------------------------------------------------------------------------------------------------------| ------ | --------| | `version` | | The version of `cargo-tarpaulin` that will be installed. | string | latest | +| `target` | ✓ | The target to install tarpaulin for i.e. `x86_64-unknown-linux-gnu`. | string | latest | | `run-types` | | The type of tests to run (`Tests`, or `Doctests`). Runs all by default. May be overridden by `args`. | string | | | `timeout` | | The timeout, in seconds, before cancelling execution of a long running test. May be overriden by `args`. | string | | | `args` | | Extra command line arguments that are passed to `cargo-tarpaulin`. | string | | diff --git a/action.yml b/action.yml index 04fd10e..effdae5 100644 --- a/action.yml +++ b/action.yml @@ -6,7 +6,7 @@ branding: color: black runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' inputs: @@ -14,6 +14,11 @@ inputs: description: 'The version of cargo-tarpaulin to install' required: true default: 'latest' + + target: + description: 'The target to install for cargo-tarpaulin' + required: true + default: 'latest' args: required: false diff --git a/src/args.ts b/src/args.ts index e35f235..7a8822d 100644 --- a/src/args.ts +++ b/src/args.ts @@ -3,6 +3,7 @@ import { OutputType } from './config'; export interface ActionInputs { requestedVersion: string, + target: String, timeout: string, runType: string, opts: string | null, @@ -11,6 +12,7 @@ export interface ActionInputs { export default function getActionInputs(): ActionInputs { const requestedVersion = input.getInput('version'); + const target = input.getInput('target'); const runType = input.getInput('run-types'); const timeout = input.getInput('timeout'); const opts = input.getInput('args'); @@ -18,6 +20,7 @@ export default function getActionInputs(): ActionInputs { return { requestedVersion, + target, runType, timeout, opts, diff --git a/src/config.ts b/src/config.ts index 18a3685..5e2cf76 100644 --- a/src/config.ts +++ b/src/config.ts @@ -44,7 +44,7 @@ export default async function resolveConfig(input: ActionInputs): Promise { +async function getDownloadUrl(releaseEndpoint: string, target: String, requestedVersion: string): Promise { const releaseInfoUri = requestedVersion === 'latest' ? `${releaseEndpoint}/latest` : `${releaseEndpoint}/tags/${requestedVersion}`; const releaseInfoRequest = await fetch(releaseInfoUri); const releaseInfo = await releaseInfoRequest.json(); - const asset = releaseInfo["assets"].find(asset => { - return asset['content_type'] === 'application/gzip'; + + const asset = releaseInfo["name"].find(asset => { + return asset['name'].startsWith(`cargo-tarpaulin-${target}`) }); if (!asset) { - throw new Error(`Couldn't find a release tarball containing binaries for ${requestedVersion}`); + throw new Error(`Couldn't find ${requestedVersion} release tarball containing ${target} binaries`); } return asset["browser_download_url"];