This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
[KIE-830] Make Kogito Operator build reproducible #3131
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Kogito Operator PR Checks | |
on: | |
pull_request: | |
paths-ignore: | |
- "README.md" | |
- "RELEASE_NOTES.md" | |
- "examples/**" | |
- "LICENSE" | |
- "Makefile" | |
env: | |
GO_VERSION: 1.21 | |
jobs: | |
golint: | |
name: Lint | |
concurrency: | |
group: ${{ github.repository.name }}_lint-${{ github.head_ref }} | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Go ${{ env.GO_VERSION }} | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
id: go | |
- name: Cache dependencies | |
uses: actions/cache@v1 | |
with: | |
path: ~/go/pkg/mod/cache | |
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-cache-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ env.GO_VERSION }}-cache- | |
- name: Cache the binaries | |
uses: actions/cache@v1 | |
with: | |
path: ~/go/bin/ | |
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-v1-${{ hashFiles(format('{0}/bin', env.GOPATH)) }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ env.GO_VERSION }}-v1-${{ hashFiles(format('{0}/bin', env.GOPATH)) }} | |
- name: Install Operator-sdk | |
run: ./hack/ci/install-operator-sdk.sh | |
- name: Check Vet | |
run: | | |
make vet | |
git diff | |
changed_files=$(git status -s | grep -v 'go.mod\|go.sum\|kogito-operator.yaml\|go.tools.mod\|go.tools.sum' || :) | |
generated_changed_files=$(git status -s | grep zz_generated || :) | |
[[ -z "$generated_changed_files" ]] || (printf "There is change in auto-generated files, Please make sure to upgrade openapi-gen" && exit 1) | |
[[ -z "$changed_files" ]] || (printf "Change is detected in some files: \n$changed_files\n Did you run 'make vet' before sending the PR?" && exit 1) | |
- name: Check Headers | |
run: | | |
./hack/addheaders.sh | |
changed_files=$(git status -s | grep -v 'go.mod\|go.sum\|kogito-operator.yaml\|go.tools.mod\|go.tools.sum' || :) | |
[[ -z "$changed_files" ]] || (printf "Some files are missing the headers: \n$changed_files\n Did you run 'make test' before sending the PR" && exit 1) | |
- name: Check Formatting | |
run: | | |
./hack/go-fmt.sh | |
changed_files=$(git status -s | grep -v 'go.mod\|go.sum\|kogito-operator.yaml\|go.tools.mod\|go.tools.sum' || :) | |
[[ -z "$changed_files" ]] || (printf "Some files are not formatted properly: \n$changed_files\n Did you run 'make test' before sending the PR?" && exit 1) | |
- name: Check lint | |
run: ./hack/go-lint.sh | |
bats_test: | |
concurrency: | |
group: ${{ github.repository.name }}_bats_tests-${{ github.head_ref }} | |
cancel-in-progress: true | |
name: Bats Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Go ${{ env.GO_VERSION }} | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
id: go | |
- name: Cache the binaries | |
uses: actions/cache@v1 | |
with: | |
path: ~/go/bin/ | |
key: ${{ runner.os }}-go-${{ env.GO_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ env.GO_VERSION }} | |
- name: Setup Bats | |
run: | | |
git clone https://github.com/bats-core/bats-core.git | |
cd bats-core && ./install.sh $HOME | |
- name: Run Bats | |
run: $HOME/bin/bats hack/*.bats |