Files
my-rook-config/.github/workflows/codegen.yml
T
Michael Adam 04af4bb93c ci: fix the codegen workflow
The codegen workflow recently sometimes failed to detect files modified
by codegen. This has been analysed in a test PR:
https://github.com/rook/rook/pull/14723

The result of the analysis is the insight that the codegen tooling did not work
as expcted because the git checkout was not located in the src/github.com
directory under the GOPATH.

This change fixes the codegen workflow by post-processing the git checkout
action by copying the git checkout directory to the expected location.

Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit f32d3df995)
2024-10-22 15:51:56 +00:00

58 lines
1.5 KiB
YAML

name: Codegen
on:
push:
tags:
- v*
branches:
- master
- release-*
pull_request:
branches:
- master
- release-*
defaults:
run:
# reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
shell: bash --noprofile --norc -eo pipefail -x {0}
# cancel the in-progress workflow when PR is refreshed.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
codegen:
runs-on: ubuntu-22.04
if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')"
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: post-process checkout - copy to github.com
run: |
# copy to the github.com path so codegen will work as expected
mkdir -p $(go env GOPATH)/src/github.com/rook/rook/
cp -R . $(go env GOPATH)/src/github.com/rook/rook/
- name: run codegen
run: |
cd $(go env GOPATH)/src/github.com/rook/rook
GOPATH=$(go env GOPATH) make codegen
- name: validate codegen
run: |
# run validation again, explicitly.
# it is also part of 'make codegen'
cd $(go env GOPATH)/src/github.com/rook/rook
tests/scripts/validate_modified_files.sh codegen