Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

[KIE-830] Make Kogito Operator build reproducible #1252

[KIE-830] Make Kogito Operator build reproducible

[KIE-830] Make Kogito Operator build reproducible #1252

name: Kogito Operator Unit Tests
on:
pull_request:
paths:
- 'api/**.go'
- 'controllers/**.go'
- 'internal/**.go'
- 'core/**.go'
- 'cmd/**.go'
env:
GO_VERSION: 1.21
jobs:
unit_test_and_coverage:
name: Unit test and Coverage
concurrency:
group: ${{ github.repository.name }}_unit_tests-${{ github.head_ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
env:
ENVTEST_ASSETS_DIR: testbin
OPERATOR_SDK_VERSION: v1.21.0
CGO_ENABLED: 0
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: Install cover
run: go install golang.org/x/tools/cmd/cover@latest
- name: Validate codcov yaml file
run: curl -vvv --data-binary @codecov.yml https://codecov.io/validate
- name: Cache testenv
uses: actions/cache@v2
with:
path: $(pwd)/${ENVTEST_ASSETS_DIR}
key: ${{ runner.os }}-testbin-${{ env.OPERATOR_SDK_VERSION }}
restore-keys: |
${{ runner.os }}-testbin-${{ env.OPERATOR_SDK_VERSION }}
- name: Run unit tests
run: |
./hack/go-test.sh
- name: Upload results of cmd to codecov
uses: codecov/codecov-action@v1
with:
file: ./cmd-cover.out
flags: cli
name: cli-test
fail_ci_if_error: true
- name: Upload results of operator to codecov
uses: codecov/codecov-action@v1
with:
file: ./core-cover.out
flags: operator
name: operator-test
fail_ci_if_error: true
- name: Upload results of operator to codecov
uses: codecov/codecov-action@v1
with:
file: ./controllers-cover.out
flags: controllers
name: controllers-test
fail_ci_if_error: true