Skip to content

Commit 6643845

Browse files
authored
#378 Migrate workflows to centralized SDK version matrix and fix job outputs (#379)
* #378 Migrate workflows to centralized SDK version matrix and fix job outputs * fix: formatting and zizmor template-injection warnings * fix: use correct env var syntax per platform (bash vs PowerShell)
1 parent e89f645 commit 6643845

File tree

7 files changed

+64
-17
lines changed

7 files changed

+64
-17
lines changed

.github/workflows/go-proxy-pull.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ permissions: {}
99

1010
jobs:
1111
go-proxy-pull:
12-
outputs:
13-
status: ${{ job.status }}
1412
permissions:
1513
contents: write
1614
runs-on: ubuntu-latest
@@ -24,10 +22,10 @@ jobs:
2422

2523
slack-notification:
2624
needs: [go-proxy-pull]
27-
if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.go-proxy-pull.outputs.status) }}
25+
if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.go-proxy-pull.result) }}
2826
secrets:
2927
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
3028
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
3129
uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v4
3230
with:
33-
job-status: ${{ needs.go-proxy-pull.outputs.status }}
31+
job-status: ${{ needs.go-proxy-pull.result }}

.github/workflows/go-test-darwin.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ env:
1818
permissions: {}
1919

2020
jobs:
21+
sdk-versions:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
senzingsdk-versions: ${{ steps.cfg.outputs.senzingsdk-versions }}
25+
steps:
26+
- id: cfg
27+
uses: senzing-factory/build-resources/sdk-versions@v4
28+
2129
go-test-darwin:
2230
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
31+
needs: sdk-versions
2332
permissions:
2433
contents: read
2534
runs-on: ${{ matrix.os }}
@@ -28,7 +37,7 @@ jobs:
2837
matrix:
2938
go: ["1.26"]
3039
os: [macos-latest]
31-
senzingsdk-version: [production-v4, staging-v4]
40+
senzingsdk-version: ${{ fromJSON(needs.sdk-versions.outputs.senzingsdk-versions) }}
3241
timeout-minutes: 30
3342

3443
steps:
@@ -79,9 +88,11 @@ jobs:
7988
enable-core-dumps: "true"
8089

8190
- name: Run go test
91+
env:
92+
SENZING_SDK_VERSION: ${{ matrix.senzingsdk-version }}
8293
run: |
8394
ulimit -c unlimited
84-
GOTRACEBACK=crash go test -exec "${GITHUB_WORKSPACE}/bin/macos_exec_dyld.sh" -json -v -p 1 -coverprofile="./cover-${{ matrix.senzingsdk-version }}.out" -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "/tmp/gotest-${{ matrix.senzingsdk-version }}.log" | gotestfmt
95+
GOTRACEBACK=crash go test -exec "${GITHUB_WORKSPACE}/bin/macos_exec_dyld.sh" -json -v -p 1 -coverprofile="./cover-${SENZING_SDK_VERSION}.out" -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "/tmp/gotest-${SENZING_SDK_VERSION}.log" | gotestfmt
8596
8697
- if: always()
8798
name: Analyze core dumps

.github/workflows/go-test-linux.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@ env:
2020
permissions: {}
2121

2222
jobs:
23+
sdk-versions:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
senzingsdk-versions: ${{ steps.cfg.outputs.senzingsdk-versions }}
27+
steps:
28+
- id: cfg
29+
uses: senzing-factory/build-resources/sdk-versions@v4
30+
2331
go-test-linux:
2432
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
33+
needs: sdk-versions
2534
permissions:
2635
contents: read
2736
runs-on: ${{ matrix.os }}
@@ -30,7 +39,7 @@ jobs:
3039
matrix:
3140
go: ["1.26"]
3241
os: [ubuntu-latest]
33-
senzingsdk-version: [production-v4, staging-v4]
42+
senzingsdk-version: ${{ fromJSON(needs.sdk-versions.outputs.senzingsdk-versions) }}
3443
timeout-minutes: 30
3544

3645
steps:
@@ -78,9 +87,11 @@ jobs:
7887
enable-core-dumps: "true"
7988

8089
- name: Run go test
90+
env:
91+
SENZING_SDK_VERSION: ${{ matrix.senzingsdk-version }}
8192
run: |
8293
ulimit -c unlimited
83-
GOTRACEBACK=crash go test -json -v -p 1 -coverprofile="./cover-${{ matrix.senzingsdk-version }}.out" -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "/tmp/gotest-${{ matrix.senzingsdk-version }}.log" | gotestfmt
94+
GOTRACEBACK=crash go test -json -v -p 1 -coverprofile="./cover-${SENZING_SDK_VERSION}.out" -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "/tmp/gotest-${SENZING_SDK_VERSION}.log" | gotestfmt
8495
8596
- if: always()
8697
name: Analyze core dumps

.github/workflows/go-test-windows.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,25 @@ env:
1818
permissions: {}
1919

2020
jobs:
21+
sdk-versions:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
senzingsdk-versions: ${{ steps.cfg.outputs.senzingsdk-versions }}
25+
steps:
26+
- id: cfg
27+
uses: senzing-factory/build-resources/sdk-versions@v4
28+
2129
go-test-windows:
2230
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: windows-latest; Go: ${{ matrix.go }}"
31+
needs: sdk-versions
2332
permissions:
2433
contents: read
2534
runs-on: windows-latest
2635
strategy:
2736
fail-fast: false
2837
matrix:
2938
go: ["1.26"]
30-
senzingsdk-version: [production-v4, staging-v4]
39+
senzingsdk-version: ${{ fromJSON(needs.sdk-versions.outputs.senzingsdk-versions) }}
3140
timeout-minutes: 30
3241

3342
steps:
@@ -65,12 +74,14 @@ jobs:
6574
copy testdata/sqlite/G2C.db "C:\Temp\sqlite\G2C.db"
6675
6776
- name: Run go test
77+
env:
78+
SENZING_SDK_VERSION: ${{ matrix.senzingsdk-version }}
6879
run: |
6980
$Env:SENZING_PATH = "$Env:USERPROFILE\Senzing"
7081
$Env:CGO_CFLAGS = "-g -I$Env:SENZING_PATH\er\sdk\c"
7182
$Env:CGO_LDFLAGS = "-L$Env:SENZING_PATH\er\lib -lSz"
72-
go test -json -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "C:\Temp\gotest-${{ matrix.senzingsdk-version }}.log" | gotestfmt
73-
cp cover "cover-${{ matrix.senzingsdk-version }}.out"
83+
go test -json -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "C:\Temp\gotest-$env:SENZING_SDK_VERSION.log" | gotestfmt
84+
cp cover "cover-$env:SENZING_SDK_VERSION.out"
7485
7586
- name: Store coverage file
7687
uses: actions/upload-artifact@v6

.github/workflows/golangci-lint.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ concurrency:
1111
permissions: {}
1212

1313
jobs:
14+
sdk-versions:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
senzingsdk-versions: ${{ steps.cfg.outputs.senzingsdk-versions }}
18+
steps:
19+
- id: cfg
20+
uses: senzing-factory/build-resources/sdk-versions@v4
21+
1422
golangci:
1523
name: Lint
24+
needs: sdk-versions
1625
permissions:
1726
# Required: allow read access to the content for analysis.
1827
contents: read
@@ -23,7 +32,7 @@ jobs:
2332
fail-fast: false
2433
matrix:
2534
go: ["1.26"]
26-
senzingsdk-version: [production-v4, staging-v4]
35+
senzingsdk-version: ${{ fromJSON(needs.sdk-versions.outputs.senzingsdk-versions) }}
2736
timeout-minutes: 10
2837

2938
steps:

.github/workflows/govulncheck.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ concurrency:
1111
permissions: {}
1212

1313
jobs:
14+
sdk-versions:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
senzingsdk-versions: ${{ steps.cfg.outputs.senzingsdk-versions }}
18+
steps:
19+
- id: cfg
20+
uses: senzing-factory/build-resources/sdk-versions@v4
21+
1422
govulncheck:
23+
needs: sdk-versions
1524
permissions:
1625
contents: read
1726
runs-on: ubuntu-latest
1827
strategy:
1928
fail-fast: false
2029
matrix:
2130
go: ["1.26"]
22-
senzingsdk-version: [production-v4, staging-v4]
31+
senzingsdk-version: ${{ fromJSON(needs.sdk-versions.outputs.senzingsdk-versions) }}
2332
timeout-minutes: 10
2433

2534
steps:

.github/workflows/make-go-tag.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ permissions: {}
1010
jobs:
1111
make-go-tag:
1212
name: Make a vM.m.P tag
13-
outputs:
14-
status: ${{ job.status }}
1513
permissions:
1614
contents: write
1715
runs-on: ubuntu-latest
@@ -33,10 +31,10 @@ jobs:
3331

3432
slack-notification:
3533
needs: [make-go-tag]
36-
if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.make-go-tag.outputs.status ) }}
34+
if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.make-go-tag.result ) }}
3735
secrets:
3836
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
3937
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
4038
uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v4
4139
with:
42-
job-status: ${{ needs.make-go-tag.outputs.status }}
40+
job-status: ${{ needs.make-go-tag.result }}

0 commit comments

Comments
 (0)