From f6b09aca53e3bb2350c6ca22c79ad8e1192b4506 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Wed, 20 Nov 2019 02:33:43 +0900 Subject: [PATCH 1/2] update goveralls --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 1f38df8..eec7e83 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 44f9d00..79b0998 100644 --- a/go.sum +++ b/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= From 1817e4007d760160c4029318f61aaad1585e91fd Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Wed, 20 Nov 2019 02:40:25 +0900 Subject: [PATCH 2/2] add job-number option --- .github/workflows/test.yml | 1 + action.yml | 3 +++ src/main.ts | 3 ++- src/runner.ts | 13 ++++++++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df7daf4..8af220f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/action.yml b/action.yml index bbe6786..d7d2cc4 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/src/main.ts b/src/main.ts index 7ccb741..ec207f3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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); diff --git a/src/runner.ts b/src/runner.ts index d651e04..c0f0b08 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -8,6 +8,7 @@ interface Options { profile: string; parallel: boolean; parallel_finished: boolean; + job_number: string; } export async function goveralls(options: Options) { @@ -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 @@ -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"); }