Feature issue 1219 #2484
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: PR validation | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
lint-test: | |
name: Validate code and charts | |
runs-on: ubuntu-20.04 | |
container: | |
image: ghcr.io/dell/csi-baremetal/csi-baremetal-devkit:latest | |
env: | |
EUID: 0 | |
EGID: 0 | |
USER_NAME: root | |
STDOUT: true | |
volumes: | |
- /root:/root | |
- /tmp:/tmp | |
- /var/run/docker.sock:/var/run/docker.sock | |
steps: | |
- name: Trust My Directory # workaround for https://github.com/actions/checkout/issues/760 | |
run: git config --global --add safe.directory /__w/csi-baremetal/csi-baremetal | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set go_version variable | |
run: echo "go_version=`echo "$(go version)" | grep -oE '[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'`" >> $GITHUB_ENV | |
- name: Load dep cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: go-dep-${{ env.go_version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: go-dep-${{ env.go_version }}- | |
- name: Load build and linter cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/go-build | |
~/.cache/golangci-lint | |
key: go-build-${{ env.go_version }}-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/pkg') }} | |
restore-keys: | | |
go-build-${{ env.go_version }}-${{ hashFiles('**/go.sum') }} | |
go-build-${{ env.go_version }}- | |
- name: Get dependencies | |
run: make dependency | |
- name: Lint code | |
run: GOGC=300 make lint | |
- name: Run Tests | |
run: CI=false make test | |
- name: Coverage | |
run: make coverage | |
- name: Upload coverage report to artifacts | |
uses: actions/[email protected] | |
with: | |
name: coverage.html | |
path: ./coverage.html | |
- name: Upload coverage report to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.out | |
flags: unittests | |
verbose: true | |
- name: Build binaries | |
run: | | |
make DRIVE_MANAGER_TYPE=basemgr build | |
make DRIVE_MANAGER_TYPE=loopbackmgr build-drivemgr | |
make DRIVE_MANAGER_TYPE=idracmgr build-drivemgr | |
- name: Test sanity | |
run: | | |
make test-sanity | |
gen-files-validate: | |
name: Generated files should be consistent | |
runs-on: ubuntu-20.04 | |
container: | |
image: ghcr.io/dell/csi-baremetal/csi-baremetal-devkit:latest | |
env: | |
EUID: 0 | |
EGID: 0 | |
USER_NAME: root | |
STDOUT: true | |
volumes: | |
- /root:/root | |
- /tmp:/tmp | |
- /var/run/docker.sock:/var/run/docker.sock | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Compile proto files | |
run: make compile-proto | |
- name: Generate CRD | |
run: | | |
make install-controller-gen | |
make generate-deepcopy | |
# Temporarily comment out the forbidden 3rd-party action script from our github PR validation workflow | |
# to fix our github PR validation startup failure. | |
# - name: Verify Changed files | |
# uses: tj-actions/[email protected] | |
# id: changed_files | |
# with: | |
# files: | | |
# api/generated/v1/*.go | |
# api/v1/*/*.go | |
# '.(go)$' | |
# | |
# - name: Display changed files | |
# if: steps.changed_files.outputs.files_changed == 'true' | |
# run: | | |
# echo "Changed files: ${{ steps.changed_files.outputs.changed_files }}" | |
# | |
# - name: Perform action when files change. | |
# if: steps.changed_files.outputs.files_changed == 'true' | |
# run: | | |
# exit 1 |