using workflow inputs/outputs

This commit is contained in:
Felipe M 2022-08-09 16:14:47 +02:00
parent 981a711d3a
commit 141721f08e
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
4 changed files with 28 additions and 7 deletions

View File

@ -1,14 +1,19 @@
name: Go
on: workflow_call
on:
workflow_call:
inputs:
go_versions:
type: string
description: Go versions to run workflow on
required: true
jobs:
build:
runs-on: ubuntu-latest
needs: go-versions
strategy:
matrix:
go_version: ${{ fromJSON(needs.go-versions.outputs.matrix) }}
go_version: ${{ fromJSON(inputs.go_versions) }}
steps:
- uses: actions/checkout@v3

View File

@ -1,6 +1,11 @@
name: Go
on: workflow_call
on:
workflow_call:
outputs:
go_versions:
description: "The golang version matrix"
value: ${{ jobs.go-versions.outputs.matrix }}
jobs:
go-versions:

View File

@ -1,14 +1,19 @@
name: "Unit Tests"
on: workflow_call
on:
workflow_call:
inputs:
go_versions:
type: string
description: Go versions to run workflow on
required: true
jobs:
test:
runs-on: ubuntu-latest
needs: go-versions
strategy:
matrix:
go_version: ${{ fromJSON(needs.go-versions.outputs.matrix) }}
go_version: ${{ fromJSON(inputs.go_versions) }}
name: Go ${{ matrix.go_version }} unit tests
steps:
- uses: actions/checkout@v2

View File

@ -16,5 +16,11 @@ jobs:
uses: ./.github/workflows/_golangci-lint.yml
call-build:
uses: ./.github/workflows/_build.yml
needs: go-versions
with:
go_versions: ${{ needs.go-versions.outputs.go_versions }}
call-test:
uses: ./.github/workflows/_test.yml
needs: go-versions
with:
go_versions: ${{ needs.go-versions.outputs.go_versions }}