cdp: added resources and verbs for the cluster role #1897
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: Golang | |
on: | |
push: | |
branches: | |
- main | |
- "maint-*" | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
branches: | |
- main | |
- "maint-*" | |
paths-ignore: | |
- 'docs/**' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
go-version: [1.21.x] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgpgme-dev libbtrfs-dev libdevmapper-dev | |
- name: Get Go dependencies | |
run: go get -v -t -d ./... | |
- name: Run tests | |
run: make test | |
- name: Build | |
run: | | |
make build | |
lint: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
go-version: [1.21.x] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgpgme-dev libbtrfs-dev libdevmapper-dev | |
- name: Ensure go modules are tidy | |
run: | | |
go mod tidy | |
if [[ -n $(git status -s) ]] ; then | |
echo | |
echo -e "\e[31mRunning 'go mod tidy' changes the current setting" | |
echo -e "\e[31mEnsure to include updated go.mod and go.sum in this PR." | |
echo -e "\e[31mThis is usually done by running 'go mod tidy'\e[0m" | |
git status -s | |
git diff --color | |
exit 1 | |
fi | |
- name: Ensure go fmt is clean | |
run: | | |
make fmt | |
if [[ -n $(git status -s) ]] ; then | |
echo | |
echo -e "\e[31mRunning 'make fmt' changes the current codebase" | |
echo -e "\e[31mEnsure to include updated codebase in this PR." | |
echo -e "\e[31mThis is usually done by running 'make fmt'\e[0m" | |
git status -s | |
git diff --color | |
exit 1 | |
fi | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
args: "--out-${NO_FUTURE}format colored-line-number --timeout=5m12s" | |
skip-pkg-cache: true | |
skip-build-cache: true | |
gosec: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
GO111MODULE: on | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Run Gosec Security Scanner | |
uses: securego/gosec@master | |
with: | |
args: "-exclude=G307 -exclude-dir=docs ./..." |