Skip to content

chore: makefile adjustment #655

chore: makefile adjustment

chore: makefile adjustment #655

name: Check for diff after go mod tidy and generated targets
on:
pull_request: {}
workflow_call:
jobs:
diff-check-manifests:
name: Check for diff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: '${{ github.workspace }}/go.mod'
cache: false
- name: Get go environment for use with cache
run: |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV
echo "go_modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV
- name: Set up cache
# https://github.com/actions/setup-go/issues/358 - cache is not working with setup-go for multiple jobs
uses: actions/cache@v4
with:
path: |
${{ env.go_cache }}
${{ env.go_modcache }}
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ env.cache_name }}-${{ runner.os }}-go-
env:
cache_name: diff-check-go-cache
- name: Make generate and deepcopy
run: |
make -f hack/Makefile mdref && make -f hack/Makefile go-bindata && make generate && make generate-deepcopy
- name: go mod tidy
run: |
go mod tidy
- name: Check for diff
run: |
gitStatus="$(git status --porcelain)"
if [[ -z "${gitStatus}" ]]; then
exit 0
fi
echo "${gitStatus}"
exit 1