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

Define ci cd pipeline #7

Merged
merged 3 commits into from
Oct 4, 2021
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Continuous Integration"
on: [push]
jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Lint"
uses: golangci/golangci-lint-action@v2
- name: "Format"
uses: Jerome1337/[email protected]
with:
gofmt-flags: '-l -d'
test:
name: "App Build and Test"
runs-on: ubuntu-latest
steps:
- name: "Check out source code"
uses: actions/checkout@v1
- name: "Set up Go 1.16"
uses: actions/setup-go@v1
with:
go-version: 1.16
- name: "Build"
env:
GOPROXY: "https://proxy.golang.org"
run: go build .
- name: "Test"
env:
GOPROXY: "https://proxy.golang.org"
run: make test
opa-test:
name: "Policies Test"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Download OPA Binary"
run: |
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64
chmod 755 ./opa
- name: "Test"
run: |
./opa test app/policies/github/*.rego -v
./opa test app/policies/gitlab/*.rego -v
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
BIN=$(CURDIR)/bin

.PHONY: test
test:
go test -v ./...

.PHONY: fmt
fmt:
go fmt ./...

.PHONY: build
build:
go build -o $(BIN)/vvw

.PHONY: clean
clean:
rm -rf $(BIN)
8 changes: 4 additions & 4 deletions app/clients/github/github_rest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewClient(oauthToken string) *github.Client {
}

type CommitInfo struct {
Repo string
Repo string
CommitUrl string
Date time.Time
AuthorName string
Expand All @@ -31,7 +31,7 @@ type CommitInfo struct {
}

type BranchCommitProtection struct {
Repo string
Repo string
BranchName string
SignatureProtected bool
Error string
Expand Down Expand Up @@ -90,7 +90,7 @@ func GetBranchSignatureProtection(client *github.Client, org string, repo string

branchesProtection = append(branchesProtection,
BranchCommitProtection{
Repo: org + "/" + repo,
Repo: org + "/" + repo,
BranchName: branch,
SignatureProtected: protectedBranch.GetEnabled(),
},
Expand All @@ -113,7 +113,7 @@ func getCommitsInfo(org string, repo string, repositoryCommits []*github.Reposit

commitsInfo = append(commitsInfo,
CommitInfo{
Repo: org + "/" + repo,
Repo: org + "/" + repo,
CommitUrl: url,
Date: date,
AuthorName: authorName,
Expand Down
4 changes: 2 additions & 2 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const (

type Project struct {
Platform string `yaml:"platform"`
Owner string `yaml:"owner"`
Repo string `yaml:"repo"`
Owner string `yaml:"owner"`
Repo string `yaml:"repo"`
}

type RepoInfoChecks struct {
Expand Down