check go work sync in unit test #378
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: ci_unit | |
on: | |
push: | |
paths: | |
- "server/**" | |
- "pkg/client-sdk/**" | |
branches: [master] | |
pull_request: | |
branches: | |
- master | |
paths: | |
- "server/**" | |
- "pkg/client-sdk/**" | |
jobs: | |
check-go-sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Run go work sync | |
run: go work sync | |
- name: Run go mod tidy | |
run: go mod tidy | |
- name: Check for changes | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "Changes detected after running go work sync and go mod tidy" | |
git diff | |
exit 1 | |
fi | |
test-server: | |
name: server unit tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./server | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ">1.17.2" | |
- uses: actions/checkout@v3 | |
- name: check linting | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
working-directory: ./server | |
- name: check code integrity | |
uses: securego/gosec@master | |
with: | |
args: "-severity high -quiet ./..." | |
- run: go get -v -t -d ./... | |
- name: unit testing | |
run: make test | |
test-sdk: | |
name: sdk unit tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./pkg/client-sdk | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ">1.17.2" | |
- uses: actions/checkout@v3 | |
- name: check linting | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
working-directory: ./pkg/client-sdk | |
- name: check code integrity | |
uses: securego/gosec@master | |
with: | |
args: "-severity high -quiet ./..." | |
- run: go get -v -t -d ./... | |
- name: unit testing | |
run: make test |