Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge esad cli into anomaly-detection (#196)
Browse files Browse the repository at this point in the history
ESAD Version 0.1 to interact with AD Plugin through cli.
  • Loading branch information
VijayanB committed Aug 5, 2020
1 parent 68429a8 commit d6dd8ab
Show file tree
Hide file tree
Showing 52 changed files with 6,642 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/esad-cli-publish-artifact-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish
on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cli
steps:
- name: Set up Go ubuntu-latest
uses: actions/setup-go@v2
with:
go-version: 1.14

- name: Check out AD CLI
uses: actions/checkout@v2

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: --snapshot --skip-publish
workdir: cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload macOS(amd64) Artifact
uses: actions/upload-artifact@v2
with:
name: esad-darwin-amd64
path: cli/dist/esad_darwin_amd64/esad

- name: Upload Linux(amd64) Artifact
uses: actions/upload-artifact@v2
with:
name: esad-linux-amd64
path: cli/dist/esad_linux_amd64/esad

- name: Upload Linux(arm64) Artifact
uses: actions/upload-artifact@v2
with:
name: esad-linux-arm64
path: cli/dist/esad_linux_arm64/esad

- name: Upload Windows(i386) Artifact
uses: actions/upload-artifact@v2
with:
name: esad-windows-386
path: cli/dist/esad_windows_386/esad.exe

- name: Upload Windows(amd64) Artifact
uses: actions/upload-artifact@v2
with:
name: esad-windows-amd64
path: cli/dist/esad_windows_amd64/esad.exe

74 changes: 74 additions & 0 deletions .github/workflows/esad-cli-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: AD CLI Test and Build
on: [pull_request, push]

jobs:
build:
defaults:
run:
working-directory: cli
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.14]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go ${{ matrix.platform }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Check out AD CLI
uses: actions/checkout@v2

- name: Build
env:
GOPROXY: "https://proxy.golang.org"
run: go build .

code-analysis:
defaults:
run:
working-directory: cli
runs-on: ubuntu-latest
steps:
- name: Set up Go ubuntu-latest
uses: actions/setup-go@v2
with:
go-version: 1.14

- name: Check out AD CLI
uses: actions/checkout@v2

- name: gofmt
run: gofmt -s -w .
- name: Check for modified files
id: git-check
run: |
echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Display unformated changes
if: steps.git-check.outputs.modified == 'true'
run: |
echo "Failed to format using go-fmt".
git diff
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.28
working-directory: cli

- name: Run coverage
env:
GOPROXY: "https://proxy.golang.org"
run: |
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: cli/coverage.out
flags: unittests
name: codecov-umbrella
23 changes: 23 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# IDE Settings
.idea/*

#OS Settings
.DS_Store

# Test binary, built with `go test -c`
*.test

bin
.go
.push-*
.container-*
.dockerfile-*

/coverage.out
39 changes: 39 additions & 0 deletions cli/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: esad
dist: ./dist
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- 386
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: 386
archives:
-
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: '{{ .ProjectName }}_checksums.txt'
snapshot:
name_template: '{{ .ProjectName }}_{{ .Version }}'
Loading

0 comments on commit d6dd8ab

Please sign in to comment.