mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #15748 from judavi/15674
Adds a reusable workflow to setup the GoVersion
This commit is contained in:
commit
ee6fde70dc
5
.github/workflows/build.yaml
vendored
5
.github/workflows/build.yaml
vendored
@ -3,8 +3,11 @@ on: [push, pull_request]
|
|||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -22,7 +25,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
run: |
|
run: |
|
||||||
|
5
.github/workflows/contrib.yaml
vendored
5
.github/workflows/contrib.yaml
vendored
@ -2,13 +2,16 @@ name: Test contrib/mixin
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: |
|
- run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
5
.github/workflows/coverage.yaml
vendored
5
.github/workflows/coverage.yaml
vendored
@ -2,8 +2,11 @@ name: Coverage
|
|||||||
on: [push]
|
on: [push]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
coverage:
|
coverage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -13,7 +16,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
run: |
|
run: |
|
||||||
|
5
.github/workflows/e2e-arm64.yaml
vendored
5
.github/workflows/e2e-arm64.yaml
vendored
@ -4,10 +4,13 @@ on:
|
|||||||
- cron: '0 1 * * *' # runs daily at 1am.
|
- cron: '0 1 * * *' # runs daily at 1am.
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
# this is to prevent the job to run at forked projects
|
# this is to prevent the job to run at forked projects
|
||||||
if: github.repository == 'etcd-io/etcd'
|
if: github.repository == 'etcd-io/etcd'
|
||||||
runs-on: [Linux, ARM64]
|
runs-on: [Linux, ARM64]
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
@ -18,7 +21,7 @@ jobs:
|
|||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
|
5
.github/workflows/e2e.yaml
vendored
5
.github/workflows/e2e.yaml
vendored
@ -2,8 +2,11 @@ name: E2E
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
@ -14,7 +17,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
|
5
.github/workflows/fuzzing.yaml
vendored
5
.github/workflows/fuzzing.yaml
vendored
@ -2,8 +2,11 @@ name: Fuzzing v3rpc
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
fuzzing:
|
fuzzing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
env:
|
env:
|
||||||
@ -12,7 +15,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: |
|
- run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
22
.github/workflows/go-version.yaml
vendored
Normal file
22
.github/workflows/go-version.yaml
vendored
Normal 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
|
5
.github/workflows/govuln.yaml
vendored
5
.github/workflows/govuln.yaml
vendored
@ -2,13 +2,16 @@ name: Go Vulnerability Checker
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- run: |
|
- run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
5
.github/workflows/grpcproxy.yaml
vendored
5
.github/workflows/grpcproxy.yaml
vendored
@ -2,8 +2,11 @@ name: grpcProxy-tests
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
@ -14,7 +17,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
|
5
.github/workflows/release.yaml
vendored
5
.github/workflows/release.yaml
vendored
@ -2,13 +2,16 @@ name: Release
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- name: release
|
- name: release
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
5
.github/workflows/robustness-template.yaml
vendored
5
.github/workflows/robustness-template.yaml
vendored
@ -17,14 +17,17 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
timeout-minutes: 210
|
timeout-minutes: 210
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: '1.19.8'
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- name: test-robustness
|
- name: test-robustness
|
||||||
env:
|
env:
|
||||||
ETCD_BRANCH: "${{ inputs.etcdBranch }}"
|
ETCD_BRANCH: "${{ inputs.etcdBranch }}"
|
||||||
|
5
.github/workflows/static-analysis.yaml
vendored
5
.github/workflows/static-analysis.yaml
vendored
@ -2,13 +2,16 @@ name: Static Analysis
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
|
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
|
||||||
with:
|
with:
|
||||||
|
5
.github/workflows/tests-arm64.yaml
vendored
5
.github/workflows/tests-arm64.yaml
vendored
@ -3,10 +3,13 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '30 1 * * *' # runs daily at 1:30 am.
|
- cron: '30 1 * * *' # runs daily at 1:30 am.
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
# this is to prevent the job to run at forked projects
|
# this is to prevent the job to run at forked projects
|
||||||
if: github.repository == 'etcd-io/etcd'
|
if: github.repository == 'etcd-io/etcd'
|
||||||
runs-on: [Linux, ARM64]
|
runs-on: [Linux, ARM64]
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -20,7 +23,7 @@ jobs:
|
|||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
|
5
.github/workflows/tests.yaml
vendored
5
.github/workflows/tests.yaml
vendored
@ -2,8 +2,11 @@ name: Tests
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
jobs:
|
jobs:
|
||||||
|
goversion:
|
||||||
|
uses: ./.github/workflows/go-version.yaml
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: goversion
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -17,7 +20,7 @@ jobs:
|
|||||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||||
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.8"
|
go-version: ${{ needs.goversion.outputs.goversion }}
|
||||||
- run: date
|
- run: date
|
||||||
- env:
|
- env:
|
||||||
TARGET: ${{ matrix.target }}
|
TARGET: ${{ matrix.target }}
|
||||||
|
@ -112,7 +112,7 @@ main() {
|
|||||||
# Check go version.
|
# Check go version.
|
||||||
log_callout "Check go version"
|
log_callout "Check go version"
|
||||||
local go_version current_go_version
|
local go_version current_go_version
|
||||||
go_version="go$(grep go-version .github/workflows/build.yaml | awk '{print $2}' | tr -d '"')"
|
go_version="go$(grep -oP '(?<=GO_VERSION:\s")[^"]*' .github/workflows/go-version.yaml | tr -d ' ')"
|
||||||
current_go_version=$(go version | awk '{ print $3 }')
|
current_go_version=$(go version | awk '{ print $3 }')
|
||||||
if [[ "${current_go_version}" != "${go_version}" ]]; then
|
if [[ "${current_go_version}" != "${go_version}" ]]; then
|
||||||
log_error "Current go version is ${current_go_version}, but etcd ${RELEASE_VERSION} requires ${go_version} (see .github/workflows/build.yaml)."
|
log_error "Current go version is ${current_go_version}, but etcd ${RELEASE_VERSION} requires ${go_version} (see .github/workflows/build.yaml)."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user