Build docker imagews for releasing v1.0.2, To #57978385 (#4303) #24
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: Project Check | |
on: | |
push: | |
branches: [ master, release-* ] | |
pull_request: | |
branches: [ master, release-* ] | |
env: | |
GO_VERSION: 1.21.10 | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
staticcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dominikh/staticcheck-action@v1 | |
lint: | |
runs-on: ubuntu-latest | |
env: | |
GOPATH: ${{ github.workspace }} | |
GO111MODULE: auto | |
defaults: | |
run: | |
working-directory: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid | |
- name: Lint golang code | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
args: --timeout 10m --verbose | |
- name: Lint preparation | |
run: | | |
arch=$(go env GOARCH) | |
os=$(go env GOOS) | |
curl -L https://get.helm.sh/helm-v3.11.1-${os}-${arch}.tar.gz | tar -xz -C /tmp | |
chmod u+x /tmp/${os}-${arch}/helm && sudo mv /tmp/${os}-${arch}/helm /usr/local/bin/helm | |
- name: CRD validation check | |
run: | | |
make update-crd | |
git status --porcelain | |
if [ -z "`git status --porcelain`" ]; then echo "CRD validation passed."; else echo "CRD validation failed. Please use 'make update-crd' to keep CRDs latest"; exit 1; fi | |
- name: OpenAPI validation check | |
run: | | |
make gen-openapi | |
echo $(git status --porcelain | grep generated) | |
if [ -z "$(git status --porcelain | grep generated)" ]; then echo "openapi validation passed."; else echo "openapi validation failed. Please use 'make gen-openapi' to update openapi"; exit 1; fi | |
- name: Project lint | |
run: | | |
test -z "$(go fmt ./... 2>/dev/null | tee /dev/stderr)" || (echo "please format Go code with 'gofmt'") | |
go vet ./... | |
find ./charts | grep Chart.yaml | xargs dirname | xargs helm lint | |
build: | |
env: | |
GOPATH: ${{ github.workspace }} | |
GO111MODULE: auto | |
CI_TEST_FLAGS: -race -coverprofile=coverage.txt -covermode=atomic | |
defaults: | |
run: | |
working-directory: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.GOPATH }}/src/github.com/fluid-cloudnative/fluid | |
- name: CI Preparation | |
run: | | |
arch=$(go env GOARCH) | |
os=$(go env GOOS) | |
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: CI script | |
run: | | |
make build | |
make test | |
bash <(curl -s https://codecov.io/bash) |