mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
ci: add go generate check
This commit is contained in:
parent
d86d82d2d4
commit
2f0b1a0f32
26
.github/actions/install_docgen/action.yml
vendored
Normal file
26
.github/actions/install_docgen/action.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Install Docgen
|
||||
description: |
|
||||
Install Docgen
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout talos
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
repository: "siderolabs/talos"
|
||||
ref: "v1.2.6"
|
||||
path: talos
|
||||
|
||||
# This is required to be able to build docgen
|
||||
- name: Remove go.work
|
||||
shell: bash
|
||||
working-directory: talos
|
||||
run: rm go.work*
|
||||
|
||||
- name: Install Docgen
|
||||
shell: bash
|
||||
working-directory: talos/hack/docgen
|
||||
run: |
|
||||
go build -o docgen .
|
||||
mv docgen /usr/local/bin
|
52
.github/workflows/test-go-generate.yml
vendored
Normal file
52
.github/workflows/test-go-generate.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
name: Go generate check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "release/**"
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
go-generate:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
||||
with:
|
||||
path: constellation
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # tag=v3.3.1
|
||||
with:
|
||||
go-version: "1.19.3"
|
||||
cache: true
|
||||
cache-dependency-path: constellation/go.mod
|
||||
|
||||
- name: Install docgen
|
||||
uses: ./constellation/.github/actions/install_docgen
|
||||
|
||||
- name: Install stringer
|
||||
shell: bash
|
||||
run: go install golang.org/x/tools/cmd/stringer@latest
|
||||
|
||||
- name: Get Go submodules
|
||||
id: submods
|
||||
shell: bash
|
||||
working-directory: constellation
|
||||
run: |
|
||||
mods=$(go list -f '{{.Dir}}' -m | xargs)
|
||||
echo "Found mods: $mods"
|
||||
echo "submods=${mods}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Go generate check
|
||||
shell: bash
|
||||
working-directory: constellation
|
||||
run: |
|
||||
mods="${{ steps.submods.outputs.submods }}"
|
||||
for mod in $mods; do
|
||||
go generate $mod/...
|
||||
done
|
||||
git diff --exit-code
|
Loading…
Reference in New Issue
Block a user