diff --git a/.github/workflows/bigtable-example.yml b/.github/workflows/bigtable-example.yml index e3bc89b934..66a2a62cee 100644 --- a/.github/workflows/bigtable-example.yml +++ b/.github/workflows/bigtable-example.yml @@ -2,6 +2,10 @@ name: Bigtable example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-bigtable: strategy: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cdcdc284c..269614ef6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,10 @@ name: Main pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test: strategy: diff --git a/.github/workflows/cockroachdb-example.yml b/.github/workflows/cockroachdb-example.yml index d40e0f87f2..a4745628c8 100644 --- a/.github/workflows/cockroachdb-example.yml +++ b/.github/workflows/cockroachdb-example.yml @@ -2,6 +2,10 @@ name: Cockroachdb example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-cockroachdb: strategy: diff --git a/.github/workflows/datastore-example.yml b/.github/workflows/datastore-example.yml index 04c824ace1..cb4495083c 100644 --- a/.github/workflows/datastore-example.yml +++ b/.github/workflows/datastore-example.yml @@ -2,6 +2,10 @@ name: Datastore example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-datastore: strategy: diff --git a/.github/workflows/firestore-example.yml b/.github/workflows/firestore-example.yml index 3faeb4f6dc..1eeb8079e3 100644 --- a/.github/workflows/firestore-example.yml +++ b/.github/workflows/firestore-example.yml @@ -2,6 +2,10 @@ name: Firestore example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-firestore: strategy: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 65fd121871..b6bbfc34f3 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -7,6 +7,10 @@ on: - main pull_request: +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + permissions: contents: read # Optional: allow read access to pull request. Use with `only-new-issues` option. diff --git a/.github/workflows/mysql-example.yml b/.github/workflows/mysql-example.yml index f7a98449a3..e7e0b62da4 100644 --- a/.github/workflows/mysql-example.yml +++ b/.github/workflows/mysql-example.yml @@ -2,6 +2,10 @@ name: Mysql example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-mysql: strategy: diff --git a/.github/workflows/nginx-example.yml b/.github/workflows/nginx-example.yml index 743a4f4337..6ce6a9f14c 100644 --- a/.github/workflows/nginx-example.yml +++ b/.github/workflows/nginx-example.yml @@ -2,6 +2,10 @@ name: Nginx example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-nginx: strategy: diff --git a/.github/workflows/postgres-example.yml b/.github/workflows/postgres-example.yml index a9cd14554d..da22e6eb61 100644 --- a/.github/workflows/postgres-example.yml +++ b/.github/workflows/postgres-example.yml @@ -2,6 +2,10 @@ name: Postgres example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-postgres: strategy: diff --git a/.github/workflows/pubsub-example.yml b/.github/workflows/pubsub-example.yml index b76e9a371a..7e414808c6 100644 --- a/.github/workflows/pubsub-example.yml +++ b/.github/workflows/pubsub-example.yml @@ -2,6 +2,10 @@ name: Pubsub example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-pubsub: strategy: diff --git a/.github/workflows/pulsar-example.yml b/.github/workflows/pulsar-example.yml index b96fbe73e3..df7ee7c9ab 100644 --- a/.github/workflows/pulsar-example.yml +++ b/.github/workflows/pulsar-example.yml @@ -2,6 +2,10 @@ name: Pulsar example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-pulsar: strategy: diff --git a/.github/workflows/redis-example.yml b/.github/workflows/redis-example.yml index cbac5d2ed8..818d4442b9 100644 --- a/.github/workflows/redis-example.yml +++ b/.github/workflows/redis-example.yml @@ -2,6 +2,10 @@ name: Redis example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-redis: strategy: diff --git a/.github/workflows/spanner-example.yml b/.github/workflows/spanner-example.yml index d7b06bf2a7..bca9098221 100644 --- a/.github/workflows/spanner-example.yml +++ b/.github/workflows/spanner-example.yml @@ -2,6 +2,10 @@ name: Spanner example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-spanner: strategy: diff --git a/.github/workflows/toxiproxy-example.yml b/.github/workflows/toxiproxy-example.yml index 6be00c7607..05eac1b499 100644 --- a/.github/workflows/toxiproxy-example.yml +++ b/.github/workflows/toxiproxy-example.yml @@ -2,6 +2,10 @@ name: Toxiproxy example pipeline on: [push, pull_request] +concurrency: + group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}" + cancel-in-progress: true + jobs: test-toxiproxy: strategy: diff --git a/examples/_template/ci.yml.tmpl b/examples/_template/ci.yml.tmpl index 1f267ad7e4..8d18fc8176 100644 --- a/examples/_template/ci.yml.tmpl +++ b/examples/_template/ci.yml.tmpl @@ -2,6 +2,10 @@ on: [push, pull_request] +concurrency: + group: {{ "${{ github.workflow }}-${{ github.head_ref || github.sha }}" }} + cancel-in-progress: true + jobs: test-{{ $lower }}: strategy: diff --git a/examples/main_test.go b/examples/main_test.go index 901aea373b..0991a76b93 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -205,12 +205,12 @@ func assertExampleGithubWorkflowContent(t *testing.T, example Example, exampleWo data := strings.Split(string(content), "\n") assert.Equal(t, "name: "+title+" example pipeline", data[0]) - assert.Equal(t, " test-"+lower+":", data[5]) - assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[15]) - assert.Equal(t, " working-directory: ./examples/"+lower, data[22]) + assert.Equal(t, " test-"+lower+":", data[9]) + assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[19]) assert.Equal(t, " working-directory: ./examples/"+lower, data[26]) assert.Equal(t, " working-directory: ./examples/"+lower, data[30]) - assert.Equal(t, " paths: \"**/TEST-"+lower+"*.xml\"", data[40]) + assert.Equal(t, " working-directory: ./examples/"+lower, data[34]) + assert.Equal(t, " paths: \"**/TEST-"+lower+"*.xml\"", data[44]) } // assert content go.mod