This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
Update README.md #607
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: Default Meshery OSM Workflow | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "v*" | |
paths-ignore: | |
- 'docs/**' | |
- '.github/**' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Check & Review code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@master | |
with: | |
go-version: 1.19 | |
- 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: v1.49 | |
# 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.19' | |
- run: GOPROXY=direct,https://proxy.golang.org GOSUMDB=off GO111MODULE=on go install -mod=mod github.com/kisielk/errcheck; /home/runner/go/bin/errcheck -tags draft ./... | |
error_code_check: | |
name: Error code utility 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.19 | |
- run: | | |
errWillHave="level=error" | |
GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/layer5io/meshkit/cmd/errorutil; | |
err=$(/home/runner/go/bin/errorutil -d . update --skip-dirs meshery -i ./helpers -o ./helpers); | |
echo "ERR: $err"; | |
if [[ $err == *"$errWillHave"* ]]; | |
then | |
echo "$err"; | |
return 1; | |
fi | |
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.19 | |
- uses: dominikh/staticcheck-action@v1.2.0 | |
with: | |
install-go: false | |
version: "2022.1.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.19' | |
- run: GOPROXY=direct,https://proxy.golang.org 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.19' | |
- name: Create cluster using KinD | |
uses: engineerd/setup-kind@v0.5.0 | |
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} | |
GOPROXY=direct,https://proxy.golang.org GOSUMDB=off GO111MODULE=on go test ./... |