.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
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
build:
runs-on: ubuntu-latest
needs: goversion
strategy:
fail-fast: false
matrix:
@ -24,9 +21,11 @@ jobs:
- linux-s390x
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

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

View File

@ -3,11 +3,8 @@ 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:
@ -15,9 +12,11 @@ jobs:
- linux-amd64-coverage
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

@ -5,13 +5,10 @@ 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: [self-hosted, Linux, ARM64]
needs: goversion
container: golang:1.19-bullseye
defaults:
run:
@ -25,10 +22,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

@ -3,11 +3,8 @@ 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:
@ -16,10 +13,11 @@ jobs:
- linux-386-e2e
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

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

View File

@ -3,11 +3,8 @@ 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:
@ -16,10 +13,11 @@ jobs:
- linux-amd64-grpcproxy-e2e
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

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

View File

@ -23,12 +23,9 @@ on:
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
timeout-minutes: 210
runs-on: ${{ fromJson(inputs.runs-on) }}
needs: goversion
container: golang:1.19-bullseye
defaults:
run:
@ -37,9 +34,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
go-version: ${{ steps.goversion.outputs.goversion }}
- name: test-robustness
env:
ETCD_BRANCH: "${{ inputs.etcdBranch }}"

View File

@ -22,17 +22,16 @@ on:
default: "['ubuntu-latest']"
permissions: read-all
jobs:
goversion:
uses: ./.github/workflows/go-version.yaml
test:
timeout-minutes: 210
runs-on: ${{ fromJson(inputs.runs-on) }}
needs: goversion
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
go-version: ${{ steps.goversion.outputs.goversion }}
- name: test-robustness
env:
ETCD_BRANCH: "${{ inputs.etcdBranch }}"

View File

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

View File

@ -5,13 +5,10 @@ on:
- cron: '30 1 * * *' # runs daily at 1:30 am.
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: [self-hosted, Linux, ARM64]
needs: goversion
container: golang:1.19-bullseye
defaults:
run:
@ -28,10 +25,11 @@ jobs:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# https://github.com/actions/checkout/issues/1169
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |

View File

@ -3,11 +3,8 @@ 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:
@ -19,10 +16,11 @@ jobs:
- linux-386-unit-1-cpu
steps:
- 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
with:
go-version: ${{ needs.goversion.outputs.goversion }}
- run: date
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |