Skip to content
Merged
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
27 changes: 24 additions & 3 deletions .github/workflows/go-test-monorepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ on:
description: extra flags to add to go test
type: string
required: false
matrix:
description: |
Optional JSON string to define the test matrix, using keys: "os" and "go".

By default tests run a 6-way matrix running on os (linux,windows,macos)
for the 2 latest go releases (stable, oldstable).

The default matrix used is:
{"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]}

type: string
required: false

defaults:
run:
Expand All @@ -27,6 +39,7 @@ jobs:
module-names: ${{ steps.detect-monorepo.outputs.names }}
coverpkg: ${{ steps.prepare-tests.outputs.coverpkg }}
all-modules: ${{ steps.prepare-tests.outputs.all-modules }}
test-matrix: ${{ steps.test-matrix.outputs.test-matrix }}
steps:
-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down Expand Up @@ -88,15 +101,23 @@ jobs:
# golangci-lint run --new-from-rev origin/master
# popd
# done < <(echo ${{ steps.detect-monorepo.outputs.bash-paths }})
-
name: Test matrix
id: test-matrix
env:
MATRIX: |
${{ inputs.test-matrix || '{"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]}' }}
run: |
echo "test-matrix<<EOF" >> "${GITHUB_OUTPUT}"
printenv MATRIX >> "${GITHUB_OUTPUT}"
echo "EOF" >> "${GITHUB_OUTPUT}"

test:
name: Unit tests mono-repo
needs: [ lint ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: ['oldstable', 'stable' ]
matrix: ${{ fromJSON(needs.lint.outputs.test-matrix) }}
steps:
-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ on:
description: extra flags to add to go test
type: string
required: false
matrix:
description: |
Optional JSON string to define the test matrix, using keys: "os" and "go".

By default tests run a 6-way matrix running on os (linux,windows,macos)
for the 2 latest go releases (stable, oldstable).

The default matrix used is:
{"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]}

type: string
required: false

defaults:
run:
Expand All @@ -20,6 +32,8 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
outputs:
test-matrix: ${{ steps.test-matrix.outputs.test-matrix }}
steps:
-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -36,16 +50,24 @@ jobs:
version: latest
only-new-issues: true
skip-cache: true
-
name: Test matrix
id: test-matrix
env:
MATRIX: |
${{ inputs.test-matrix || '{"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]}' }}
run: |
echo "test-matrix<<EOF" >> "${GITHUB_OUTPUT}"
printenv MATRIX >> "${GITHUB_OUTPUT}"
echo "EOF" >> "${GITHUB_OUTPUT}"

test:
name: Unit tests
runs-on: ${{ matrix.os }}
needs: [lint]

strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: ['oldstable', 'stable' ]
matrix: ${{ fromJSON(needs.lint.outputs.test-matrix) }}

steps:
-
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github.com/go-openapi/testify/v2 v2.4.1/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
2 changes: 1 addition & 1 deletion sample-monorepo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/go-openapi/ci-workflows/sample-monorepo

go 1.25.0

require github.com/go-openapi/testify/v2 v2.4.1
require github.com/go-openapi/testify/v2 v2.4.2
3 changes: 2 additions & 1 deletion sample-monorepo/go.sum
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
github.com/go-openapi/testify/v2 v2.4.1 h1:zB34HDKj4tHwyUQHrUkpV0Q0iXQ6dUCOQtIqn8hE6Iw=
github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4=
github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw=
Loading