Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: run jobs if and only if the upstream workflow completed with success #1133

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/bigtable-example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Bigtable example pipeline

on:
workflow_run:
workflows: [Module generator pipeline]
types:
- completed
push:
paths-ignore:
- 'mkdocs.yml'
Expand All @@ -18,6 +22,7 @@ concurrency:

jobs:
test-bigtable:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-modulegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ concurrency:
cancel-in-progress: true

jobs:
test:
test-modulegen:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci-reaper-off.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Reaper-Off pipeline

on:
workflow_run:
workflows: [golangci-lint / static-analysis]
types:
- completed
push:
paths-ignore:
- 'mkdocs.yml'
Expand All @@ -18,6 +22,7 @@ concurrency:

jobs:
test-reaper-off:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cockroachdb-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-cockroachdb:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/consul-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-consul:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/datastore-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-datastore:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/firestore-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-firestore:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:

jobs:
test-compose:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-couchbase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-couchbase:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-localstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-localstack:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-mysql:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-neo4j.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-neo4j:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-postgres:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-pulsar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-pulsar:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-redis:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/module-vault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-vault:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mongodb-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-mongodb:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nginx-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-nginx:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pubsub-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-pubsub:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spanner-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-spanner:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/toxiproxy-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-toxiproxy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
1 change: 1 addition & 0 deletions modulegen/_template/ci.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ concurrency:

jobs:
test-{{ $lower }}:
if: {{ "${{ github.event.workflow_run.conclusion == 'success' }}" }}
strategy:
matrix:
go-version: [1.19.x, 1.x]
Expand Down
5 changes: 3 additions & 2 deletions modulegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package main
import (
"flag"
"fmt"
"html/template"
htmltemplate "html/template"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"
"text/template"
"unicode"
"unicode/utf8"

Expand Down Expand Up @@ -182,7 +183,7 @@ func generate(example Example, rootDir string) error {
"ParentDir": func() string { return example.ParentDir() },
"ToLower": func() string { return example.Lower() },
"Title": func() string { return example.Title() },
"codeinclude": func(s string) template.HTML { return template.HTML(s) }, // escape HTML comments for codeinclude
"codeinclude": func(s string) htmltemplate.HTML { return htmltemplate.HTML(s) }, // escape HTML comments for codeinclude
}

// create the example dir
Expand Down
11 changes: 6 additions & 5 deletions modulegen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,12 @@ func assertExampleGithubWorkflowContent(t *testing.T, example Example, exampleWo
data := strings.Split(sanitiseContent(string(content)), "\n")
assert.Equal(t, "name: "+title+" "+example.Type()+" pipeline", data[0])
assert.Equal(t, " test-"+lower+":", data[23])
assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[33])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[40])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[44])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[48])
assert.Equal(t, " paths: \"**/TEST-"+lower+"*.xml\"", data[58])
assert.Equal(t, " if: ${{ github.event.workflow_run.conclusion == 'success' }}", data[24])
assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[34])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[41])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[45])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[49])
assert.Equal(t, " paths: \"**/TEST-"+lower+"*.xml\"", data[59])
}

// assert content go.mod
Expand Down