downstream v2.0.0 (#183) #955
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: Unit Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- downstream | |
- main | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Display build environment | |
run: printenv | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
stable: 'true' | |
go-version: '1.18' # The Go version to download (if necessary) and use. | |
- name: Cache Go modules | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | |
- name: Install kubebuilder | |
run : | | |
os=$(go env GOOS) | |
arch=$(go env GOARCH) | |
curl -L "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_${os}_${arch}.tar.gz" | tar -xz -C /tmp/ | |
sudo mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder | |
export PATH=$PATH:/usr/local/kubebuilder/bin | |
- name: Run tests | |
run: | | |
make generate manifests | |
go test ./... -v -coverprofile cover.out -covermode=atomic | |
- name: Upload coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./cover.out | |
flags: unittests |