diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 54295a7..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: Go - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.21.1' - - - name: Build - run: go build -v ./... - - - name: Test - run: go test -v ./... diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000..be239a9 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,79 @@ +name: OpenSource CI/CD + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: + - master + - main + - staging + - develop + pull_request: + branches: + - master + - main + - staging + - develop + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: "1.21.4" + + - name: Run build + run: go build . + + lint: + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: "1.21.4" + + - name: Install linters + run: | + go install golang.org/x/lint/golint@latest + go install github.com/fzipp/gocyclo/cmd/gocyclo@latest + go install github.com/client9/misspell/cmd/misspell@latest + go install github.com/gordonklaus/ineffassign@latest + # go install github.com/securego/gosec/cmd/gosec@latest + + - name: Run golint + run: | + echo "Starting golint..." + golint ./... + echo "Completed golint" + + - name: Run gocyclo + run: | + echo "Starting gocyclo..." + gocyclo -over 15 . + echo "Completed gocyclo" + + - name: Run misspell + run: | + echo "Starting misspell..." + misspell -error . + echo "Completed misspell" + + - name: Run ineffassign + run: | + echo "Starting ineffassign..." + ineffassign . + echo -e "\033[32mCompleted ineffassign\033[0m" + + # - name: Run gosec + # run: gosec ./...