Centralizing workflow go-version variable

Signed-off-by: Juan <1766933+judavi@users.noreply.github.com>
This commit is contained in:
Juan
2023-04-20 09:52:28 +00:00
parent b27dec8b94
commit 0df7c48ddd
15 changed files with 75 additions and 14 deletions

View File

@@ -3,8 +3,11 @@ on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
build:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: false
matrix:
@@ -22,7 +25,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

@@ -2,13 +2,16 @@ name: Test contrib/mixin
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
runs-on: ubuntu-latest
needs: goversion
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: |
set -euo pipefail

View File

@@ -2,8 +2,11 @@ name: Coverage
on: [push]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
coverage:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: false
matrix:
@@ -13,7 +16,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

@@ -4,10 +4,13 @@ on:
- cron: '0 1 * * *' # runs daily at 1am.
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
# this is to prevent the job to run at forked projects
if: github.repository == 'etcd-io/etcd'
runs-on: [Linux, ARM64]
needs: goversion
strategy:
fail-fast: true
matrix:
@@ -18,7 +21,7 @@ jobs:
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
ref: main
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}

View File

@@ -2,8 +2,11 @@ name: E2E
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: true
matrix:
@@ -14,7 +17,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}

View File

@@ -2,8 +2,11 @@ name: Fuzzing v3rpc
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
fuzzing:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: false
env:
@@ -12,7 +15,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: |
set -euo pipefail

22
.github/workflows/go-version.yaml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Go version setup
env:
GO_VERSION: "1.19.8"
on:
workflow_call:
outputs:
goversion:
value: ${{ jobs.version.outputs.goversion }}
jobs:
version:
name: Set Go version variable for all the workflows
runs-on: ubuntu-latest
outputs:
goversion: ${{ steps.step1.outputs.goversion }}
steps:
- id: step1
run: |
echo "Go Version: $GO_VERSION"
echo "goversion=$GO_VERSION" >> $GITHUB_OUTPUT

View File

@@ -2,13 +2,16 @@ name: Go Vulnerability Checker
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
runs-on: ubuntu-latest
needs: goversion
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- run: |
set -euo pipefail

View File

@@ -2,8 +2,11 @@ name: grpcProxy-tests
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: true
matrix:
@@ -14,7 +17,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}

View File

@@ -2,13 +2,16 @@ name: Release
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
main:
runs-on: ubuntu-latest
needs: goversion
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- name: release
run: |
set -euo pipefail

View File

@@ -17,14 +17,17 @@ on:
type: string
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
timeout-minutes: 210
runs-on: ubuntu-latest
needs: goversion
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.19.8'
go-version: ${{ needs.goversion.outputs.goversion }}
- name: test-robustness
env:
ETCD_BRANCH: "${{ inputs.etcdBranch }}"

View File

@@ -2,13 +2,16 @@ name: Static Analysis
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
run:
runs-on: ubuntu-latest
needs: goversion
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:

View File

@@ -3,10 +3,13 @@ on:
schedule:
- cron: '30 1 * * *' # runs daily at 1:30 am.
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
# this is to prevent the job to run at forked projects
if: github.repository == 'etcd-io/etcd'
runs-on: [Linux, ARM64]
needs: goversion
strategy:
fail-fast: false
matrix:
@@ -20,7 +23,7 @@ jobs:
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
ref: main
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}

View File

@@ -2,8 +2,11 @@ name: Tests
on: [push, pull_request]
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: false
matrix:
@@ -17,7 +20,7 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: "1.19.8"
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}