forked from red-hat-storage/odf-multicluster-orchestrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update github actions and add local test tools
This commit adds make targets to install testing tools locally and run various tests as github actions can not be used locally. Local tools and github actions share configurations as much as possible to ensure identical test criteria. Signed-off-by: Umanga Chapagain <[email protected]>
- Loading branch information
1 parent
5f4f030
commit 8d9fdde
Showing
11 changed files
with
252 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Lint Codebase | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
golangci-lint: | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
|
||
name: Go | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.41.1 | ||
only-new-issues: true | ||
|
||
kube-linter: | ||
name: Kube YAML | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Lint | ||
uses: stackrox/[email protected] | ||
with: | ||
directory: config/ | ||
config: .kube-linter-config.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Tests & Builds | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ '*' ] | ||
|
||
env: | ||
GO_VERSION: "1.16" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
clean-workdir: | ||
name: Ensure Clean Workdir | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Scan for uncommitted changes | ||
run: make ensure-clean-workdir | ||
|
||
unit-test: | ||
name: Unit Tests | ||
needs: clean-workdir | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Run unit tests | ||
run: make unit-test | ||
|
||
integration-test: | ||
name: Integration Tests | ||
needs: clean-workdir | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Run integration tests | ||
run: make test | ||
|
||
build-operator: | ||
name: Build Operator Image | ||
needs: [unit-test,integration-test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Build | ||
run: make docker-build | ||
|
||
validate-bundle: | ||
name: Validate Operator Bundle | ||
needs: clean-workdir | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Validate | ||
run: make bundle | ||
|
||
build-bundle: | ||
name: Build Bundle Image | ||
needs: validate-bundle | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Build | ||
run: make bundle-build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file contains golangci-lint configurations | ||
|
||
# options for analysis running | ||
run: | ||
timeout: 5m | ||
modules-download-mode: readonly | ||
|
||
linters-settings: | ||
errcheck: | ||
# report about not checking of errors in type assertions: `a := b.(MyStruct)`; | ||
# default is false: such cases aren't reported by default. | ||
check-type-assertions: true | ||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; | ||
# default is false: such cases aren't reported by default. | ||
check-blank: true | ||
gocognit: | ||
# minimal code complexity to report, 30 by default (but we recommend 10-20) | ||
min-complexity: 15 | ||
gocyclo: | ||
# minimal code complexity to report, 30 by default (but we recommend 10-20) | ||
min-complexity: 15 | ||
goheader: | ||
template: | | ||
Copyright 2021 Red Hat OpenShift Data Foundation. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
misspell: | ||
locale: US | ||
|
||
# output configuration options | ||
output: | ||
print-issued-lines: true | ||
sort-results: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
checks: | ||
include: | ||
- "cluster-admin-role-binding" | ||
- "exposed-services" | ||
- "privileged-ports" | ||
- "writable-host-mount" | ||
exclude: | ||
- "dangling-service" | ||
- "default-service-account" | ||
- "mismatching-selector" | ||
- "no-read-only-root-fs" | ||
- "non-existent-service-account" | ||
- "run-as-non-root" | ||
- "unset-cpu-requirements" | ||
- "unset-memory-requirements" | ||
- "latest-tag" |
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
Oops, something went wrong.