Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Enable Unittest #140

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .pipelines/unittest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
jobs:
- job: Unittest
timeoutInMinutes: 120

pool:
vmImage: "windows-latest"

variables:
- group: moc-build
- name: GO111MODULE
value: "on"

steps:
- task: GoTool@0
inputs:
version: "1.22.5"
- task: InstallSSHKey@0
inputs:
knownHostsEntry: "$(KNOWN_HOST)"
sshPublicKey: "$(SSH_PUBLIC_KEY)"
sshKeySecureFile: "azure-pipelines-ssh-key-new"
- script: |
git config --global url.ssh://git@github.com/.insteadOf https://github.com/
git config --global url."msazure@vs-ssh.visualstudio.com:v3".insteadOf https://msazure.visualstudio.com
displayName: "Set up the Go workspace"

- script: |
make unittest
workingDirectory: "$(System.DefaultWorkingDirectory)"
timeoutInMinutes: 120
displayName: "Build"

- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: "SBOM Generation"
inputs:
BuildDropPath: $(System.DefaultWorkingDirectory)/manifest

- publish: $(System.DefaultWorkingDirectory)/manifest
artifact: manifest
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
GOCMD=go
GOBUILD=$(GOCMD) build -v
GOHOSTOS=$(strip $(shell $(GOCMD) env get GOHOSTOS))
GOTEST=GOOS=$(GOHOSTOS) $(GOCMD) test -v -coverprofile=coverage.out -covermode count -timeout 60m0s
PKGS=./...


TAG ?= $(shell git describe --tags)
COMMIT ?= $(shell git describe --always)
Expand All @@ -24,3 +27,10 @@ format:

test:
GOOS=windows GO111MODULE=on GOARCH=amd64 go test -v ./go/...

prereq:
git config --global url.ssh://git@github.com/.insteadOf https://github.com/
# if you see port already bound issues for etcd tests, consider limiting
# parallel execution using '-p 1'
unittest: prereq
$(GOTEST) $(PKGS)
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ schedules:
jobs:
- template: .pipelines/build.yaml
- template: .pipelines/static.yaml
- template: .pipelines/unittest.yaml
Loading