Skip to content

Merge pull request #293 from devhindo/updatego #569

Merge pull request #293 from devhindo/updatego

Merge pull request #293 from devhindo/updatego #569

Workflow file for this run

name: Meshery Nginx SM
on:
push:
branches:
- "*"
paths:
- "**.go"
tags:
- "v*"
pull_request:
branches:
- master
paths:
- "**.go"
jobs:
lint:
name: Check & Review code
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@master
with:
go-version: 1.23
- uses: actions/checkout@master
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
error_check:
name: Error check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: 1.23
- run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/kisielk/errcheck@latest; /home/runner/go/bin/errcheck -tags draft ./...
static_check:
name: Static check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: 1.23
- uses: dominikh/[email protected]
with:
install-go: false
version: "2022.1"
vet:
name: Vet
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: 1.23
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go vet -tags draft ./...
sec_check:
name: Security check
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G301,G304,G107,G101,G110 ./...
tests:
# needs: [lint, error_check, static_check, vet, sec_check]
name: Tests
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: 1.23
- name: Create cluster using KinD
uses: engineerd/[email protected]
with:
version: "v0.11.0"
- run: |
export CURRENTCONTEXT="$(kubectl config current-context)"
echo "current-context:" ${CURRENTCONTEXT}
export KUBECONFIG="${HOME}/.kube/config"
echo "environment-kubeconfig:" ${KUBECONFIG}
make test
tidy:
name: tidy
needs: [lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@master
with:
go-version: '1.21'
cache: true
cache-dependency-path: go.sum
- name: go mod tidy
run: make tidy
codecov:
name: codecov
needs: [ tidy ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@master
with:
go-version: '1.21'
cache: true
cache-dependency-path: go.sum
- name: Unit test
run: make test
- name: Upload covergae to Codecov
if: github.repository == 'meshery/meshery-nginx-sm'
uses: codecov/codecov-action@v3
with:
files: ./coverage.out
flags: unittests