Skip to content

Commit

Permalink
Merge pull request #5 from shogo82148/update-goveralls-2019-11-20
Browse files Browse the repository at this point in the history
Update goveralls 2019 11 20
  • Loading branch information
shogo82148 committed Nov 19, 2019
2 parents 9d6bcf7 + 1817e40 commit 62e9f6f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Expand Up @@ -34,6 +34,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-profile: profile.cov
parallel: true
job-number: ${{ strategy.job-index }}

finish:
needs: test
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Expand Up @@ -17,6 +17,9 @@ inputs:
description: 'Set to true for the last action when using "parallel: true".'
required: false
default: false
job-number:
description: "job number"
required: false

runs:
using: 'node12'
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -3,6 +3,6 @@ module github.com/shogo82148/actions-goveralls
go 1.13

require (
github.com/mattn/goveralls v0.0.5-0.20191107062956-d8d16fd0ea3f
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2 // indirect
github.com/mattn/goveralls v0.0.5-0.20191119023345-1ebf065cc210
golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
@@ -1,10 +1,10 @@
github.com/mattn/goveralls v0.0.5-0.20191107062956-d8d16fd0ea3f h1:Wz4kfbSQsufLhD0isRMeQeXRxoVygPl4nhWF1AHfTLk=
github.com/mattn/goveralls v0.0.5-0.20191107062956-d8d16fd0ea3f/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/mattn/goveralls v0.0.5-0.20191119023345-1ebf065cc210 h1:EIN/EfRbKDnc69CGfd188iO5Cvg2L/zO6yAt/c5qvIc=
github.com/mattn/goveralls v0.0.5-0.20191119023345-1ebf065cc210/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2 h1:EtTFh6h4SAKemS+CURDMTDIANuduG5zKEXShyy18bGA=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98 h1:tZwpOHmF1OEL9wJGSgBALnhFg/8VKjQTtctCX51GLNI=
golang.org/x/tools v0.0.0-20191118222007-07fc4c7f2b98/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3 changes: 2 additions & 1 deletion src/main.ts
Expand Up @@ -9,7 +9,8 @@ async function run() {
parallel: parseBoolean(core.getInput("parallel") || "false"),
parallel_finished: parseBoolean(
core.getInput("parallel-finished") || "false"
)
),
job_number: core.getInput("job-number")
});
} catch (error) {
core.setFailed(error.message);
Expand Down
13 changes: 10 additions & 3 deletions src/runner.ts
Expand Up @@ -8,6 +8,7 @@ interface Options {
profile: string;
parallel: boolean;
parallel_finished: boolean;
job_number: string;
}

export async function goveralls(options: Options) {
Expand All @@ -29,8 +30,7 @@ export async function goveralls(options: Options) {

async function run(options: Options, job_id: string) {
const env = {
COVERALLS_TOKEN: options.token,
BUILD_NUMBER: job_id
COVERALLS_TOKEN: options.token
};

// copy environment values related to Go
Expand Down Expand Up @@ -70,7 +70,14 @@ async function run(options: Options, job_id: string) {
env[name] = value;
}
}
const args = [`-coverprofile=${options.profile}`, "-service=github"];
const args = [
`-coverprofile=${options.profile}`,
"-service=github",
`-jobid=${job_id}`
];
if (options.job_number) {
args.push(`-jobnumber=${options.job_number}`);
}
if (options.parallel) {
args.push("-parallel");
}
Expand Down

0 comments on commit 62e9f6f

Please sign in to comment.