Skip to content

Commit

Permalink
chore: reduce concurrent builds (testcontainers#702)
Browse files Browse the repository at this point in the history
* chore: reduce concurrent builds

It will avoid multiple pushes to have concurrent builds, aborting
running builds in the followins scenarios:
- for PRs, a new commit will abort running builds for the workflow
- for branches, because it will use the SHA commit as discriminator, a new commit won't abort the running builds

* fix: update generator test
  • Loading branch information
mdelapenya authored Dec 19, 2022
1 parent bb03057 commit e9fa657
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/bigtable-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/cockroachdb-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/datastore-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/firestore-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/mysql-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nginx-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/postgres-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pubsub-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pulsar-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/redis-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/spanner-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/toxiproxy-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions examples/_template/ci.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9fa657

Please sign in to comment.