.github/workflows: Read .go-version as a step and not separate workflow

Signed-off-by: Marek Siarkowicz <serathius@users.noreply.github.com>
This commit is contained in:
Marek Siarkowicz 2023-06-09 20:07:09 +02:00
parent a708bed336
commit eb56d86e40
15 changed files with 42 additions and 84 deletions

View File

@ -4,11 +4,8 @@ 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:
@ -24,9 +21,11 @@ jobs:
- linux-s390x - linux-s390x
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -3,16 +3,15 @@ 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
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: | - run: |
set -euo pipefail set -euo pipefail

View File

@ -3,11 +3,8 @@ 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:
@ -15,9 +12,11 @@ jobs:
- linux-amd64-coverage - linux-amd64-coverage
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -5,13 +5,10 @@ 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: [self-hosted, Linux, ARM64] runs-on: [self-hosted, Linux, ARM64]
needs: goversion
container: golang:1.19-bullseye container: golang:1.19-bullseye
defaults: defaults:
run: run:
@ -25,10 +22,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169 # https://github.com/actions/checkout/issues/1169
- run: git config --system --add safe.directory '*' - run: git config --system --add safe.directory '*'
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -3,11 +3,8 @@ 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:
@ -16,10 +13,11 @@ jobs:
- linux-386-e2e - linux-386-e2e
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -3,20 +3,19 @@ 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:
TARGET_PATH: ./server/etcdserver/api/v3rpc TARGET_PATH: ./server/etcdserver/api/v3rpc
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: | - run: |
set -euo pipefail set -euo pipefail

View File

@ -1,23 +0,0 @@
---
name: Go version setup
permissions: read-all
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.goversion.outputs.goversion }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: |
GO_VERSION=$(cat .go-version)
echo "Go Version: $GO_VERSION"
echo "goversion=$GO_VERSION" >> $GITHUB_OUTPUT

View File

@ -3,16 +3,15 @@ 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
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date - run: date
- run: | - run: |
set -euo pipefail set -euo pipefail

View File

@ -3,11 +3,8 @@ 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:
@ -16,10 +13,11 @@ jobs:
- linux-amd64-grpcproxy-e2e - linux-amd64-grpcproxy-e2e
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -3,16 +3,15 @@ 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
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- name: release - name: release
run: | run: |
set -euo pipefail set -euo pipefail

View File

@ -23,12 +23,9 @@ on:
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: ${{ fromJson(inputs.runs-on) }} runs-on: ${{ fromJson(inputs.runs-on) }}
needs: goversion
container: golang:1.19-bullseye container: golang:1.19-bullseye
defaults: defaults:
run: run:
@ -37,9 +34,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169 # https://github.com/actions/checkout/issues/1169
- run: git config --system --add safe.directory '*' - run: git config --system --add safe.directory '*'
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- name: test-robustness - name: test-robustness
env: env:
ETCD_BRANCH: "${{ inputs.etcdBranch }}" ETCD_BRANCH: "${{ inputs.etcdBranch }}"

View File

@ -22,17 +22,16 @@ on:
default: "['ubuntu-latest']" default: "['ubuntu-latest']"
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: ${{ fromJson(inputs.runs-on) }} runs-on: ${{ fromJson(inputs.runs-on) }}
needs: goversion
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- name: test-robustness - name: test-robustness
env: env:
ETCD_BRANCH: "${{ inputs.etcdBranch }}" ETCD_BRANCH: "${{ inputs.etcdBranch }}"

View File

@ -3,16 +3,15 @@ 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
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@5f1fec7010f6ae3b84ea4f7b2129beb8639b564f # v3.5.0 uses: golangci/golangci-lint-action@5f1fec7010f6ae3b84ea4f7b2129beb8639b564f # v3.5.0
with: with:

View File

@ -5,13 +5,10 @@ on:
- cron: '30 1 * * *' # runs daily at 1:30 am. - cron: '30 1 * * *' # runs daily at 1:30 am.
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: [self-hosted, Linux, ARM64] runs-on: [self-hosted, Linux, ARM64]
needs: goversion
container: golang:1.19-bullseye container: golang:1.19-bullseye
defaults: defaults:
run: run:
@ -28,10 +25,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169 # https://github.com/actions/checkout/issues/1169
- run: git config --system --add safe.directory '*' - run: git config --system --add safe.directory '*'
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |

View File

@ -3,11 +3,8 @@ 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:
@ -19,10 +16,11 @@ jobs:
- linux-386-unit-1-cpu - linux-386-unit-1-cpu
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with: with:
go-version: ${{ needs.goversion.outputs.goversion }} go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env: - env:
TARGET: ${{ matrix.target }} TARGET: ${{ matrix.target }}
run: | run: |