Skip to content

Commit 7092188

Browse files
committed
Initial import
0 parents  commit 7092188

File tree

3,416 files changed

+4377642
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,416 files changed

+4377642
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: ci
2+
on: pull_request
3+
jobs:
4+
go-lint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Install Go
8+
uses: actions/setup-go@v3
9+
with:
10+
go-version: 1.19.x
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
- name: Run linters
14+
uses: golangci/golangci-lint-action@v3
15+
with:
16+
version: latest
17+
args: --timeout=3m
18+
go-test:
19+
strategy:
20+
matrix:
21+
go-version: [1.18.x, 1.19.x]
22+
platform: [ubuntu-latest]
23+
runs-on: ${{ matrix.platform }}
24+
steps:
25+
- name: Install Go
26+
if: success()
27+
uses: actions/setup-go@v3
28+
with:
29+
go-version: ${{ matrix.go-version }}
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
- name: go tests
33+
run: go test -v -covermode=count -json ./... > test.json
34+
- name: annotate go tests
35+
if: always()
36+
uses: guyarb/[email protected]
37+
with:
38+
test-results: test.json

.github/workflows/main.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: main ci
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
go-lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install Go
11+
uses: actions/setup-go@v3
12+
with:
13+
go-version: 1.19.x
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
- name: Run linters
17+
uses: golangci/golangci-lint-action@v3
18+
with:
19+
version: latest
20+
args: --timeout=3m
21+
go-test:
22+
strategy:
23+
matrix:
24+
go-version: [ 1.18.x, 1.19.x ]
25+
platform: [ ubuntu-latest ]
26+
runs-on: ${{ matrix.platform }}
27+
steps:
28+
- name: Install Go
29+
if: success()
30+
uses: actions/setup-go@v3
31+
with:
32+
go-version: ${{ matrix.go-version }}
33+
- name: Checkout code
34+
uses: actions/checkout@v3
35+
- name: go tests
36+
run: go test -v -covermode=count -json ./... > test.json
37+
- name: annotate go tests
38+
if: always()
39+
uses: guyarb/[email protected]
40+
with:
41+
test-results: test.json

.github/workflows/release.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.19
20+
- name: Set up Gon
21+
run: brew tap mitchellh/gon && brew install mitchellh/gon/gon
22+
- name: Import Keychain Certs
23+
uses: apple-actions/import-codesign-certs@v1
24+
with:
25+
p12-file-base64: ${{ secrets.APPLE_SIGNING_KEY_P12 }}
26+
p12-password: ${{ secrets.APPLE_SIGNING_KEY_P12_PASSWORD }}
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v2
29+
with:
30+
version: latest
31+
args: release --rm-dist
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }}
34+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
35+
goreleaser-docker:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
with:
41+
fetch-depth: 0
42+
- name: Set up Go
43+
uses: actions/setup-go@v2
44+
with:
45+
go-version: 1.19
46+
- name: Docker Login
47+
uses: docker/login-action@v1
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.repository_owner }}
51+
password: ${{ secrets.RELENG_GITHUB_TOKEN }}
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v1
54+
- name: Run GoReleaser
55+
uses: goreleaser/goreleaser-action@v2
56+
with:
57+
version: latest
58+
args: release --rm-dist -f .goreleaser.docker.yaml
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.RELENG_GITHUB_TOKEN }}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
build/
8+
*.c1z
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Dependency directories (remove the comment below to include it)
17+
# vendor/
18+
dist/

.golangci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
linters-settings:
2+
exhaustive:
3+
default-signifies-exhaustive: true
4+
5+
gocritic:
6+
# The list of supported checkers can be find in https://go-critic.github.io/overview.
7+
settings:
8+
underef:
9+
# Whether to skip (*x).method() calls where x is a pointer receiver.
10+
skipRecvDeref: false
11+
12+
govet:
13+
enable-all: true
14+
disable:
15+
- fieldalignment # too strict
16+
- shadow # complains too much about shadowing errors. All research points to this being fine.
17+
18+
nakedret:
19+
max-func-lines: 0
20+
21+
nolintlint:
22+
allow-no-explanation: [ forbidigo, tracecheck, gomnd, gochecknoinits, makezero ]
23+
require-explanation: true
24+
require-specific: true
25+
26+
revive:
27+
ignore-generated-header: true
28+
severity: error
29+
rules:
30+
- name: atomic
31+
- name: line-length-limit
32+
arguments: [ 200 ]
33+
# These are functions that we use without checking the errors often. Most of these can't return an error even
34+
# though they implement an interface that can.
35+
- name: unhandled-error
36+
arguments:
37+
- fmt.Printf
38+
- fmt.Println
39+
- fmt.Fprintf
40+
- fmt.Fprintln
41+
- os.Stderr.Sync
42+
- sb.WriteString
43+
- buf.WriteString
44+
- hasher.Write
45+
- os.Setenv
46+
- os.RemoveAll
47+
- name: var-naming
48+
arguments: [["ID", "URL", "HTTP", "API"], []]
49+
50+
tenv:
51+
all: true
52+
53+
varcheck:
54+
exported-fields: false # this appears to improperly detect exported variables as unused when they are used from a package with the same name
55+
56+
57+
linters:
58+
disable-all: true
59+
enable:
60+
- deadcode # Finds unused code
61+
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
62+
- gosimple # Linter for Go source code that specializes in simplifying a code
63+
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
64+
- ineffassign # Detects when assignments to existing variables are not used
65+
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
66+
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
67+
- unused # Checks Go code for unused constants, variables, functions and types
68+
- varcheck # Finds unused global variables and constants
69+
- asasalint # Check for pass []any as any in variadic func(...any)
70+
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
71+
- bidichk # Checks for dangerous unicode character sequences
72+
- bodyclose # checks whether HTTP response body is closed successfully
73+
- durationcheck # check for two durations multiplied together
74+
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
75+
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
76+
- exhaustive # check exhaustiveness of enum switch statements
77+
- exportloopref # checks for pointers to enclosing loop variables
78+
- forbidigo # Forbids identifiers
79+
- gochecknoinits # Checks that no init functions are present in Go code
80+
- goconst # Finds repeated strings that could be replaced by a constant
81+
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
82+
- godot # Check if comments end in a period
83+
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
84+
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
85+
- goprintffuncname # Checks that printf-like functions are named with f at the end
86+
- gosec # Inspects source code for security problems
87+
- nakedret # Finds naked returns in functions greater than a specified function length
88+
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
89+
- noctx # noctx finds sending http request without context.Context
90+
- nolintlint # Reports ill-formed or insufficient nolint directives
91+
- nonamedreturns # Reports all named returns
92+
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
93+
- predeclared # find code that shadows one of Go's predeclared identifiers
94+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
95+
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
96+
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
97+
- unconvert # Remove unnecessary type conversions
98+
- usestdlibvars # detect the possibility to use variables/constants from the Go standard library
99+
- whitespace # Tool for detection of leading and trailing whitespace
100+
101+
issues:
102+
max-same-issues: 50
103+
104+
exclude-rules:
105+
# Don't require TODO comments to end in a period
106+
- source: "(TODO)"
107+
linters: [ godot ]

.gon-amd64.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"source": ["./dist/macos-amd64_darwin_amd64_v1/baton-github"],
3+
"bundle_id": "com.conductorone.connector-github",
4+
"apple_id": {
5+
"username" : "[email protected]",
6+
"password": "@env:AC_PASSWORD"
7+
},
8+
"sign": {
9+
"application_identity": "Developer ID Application: Justin Gallardo (858DKH55XL)"
10+
},
11+
"zip" :{
12+
"output_path": "./dist/baton-github-darwin-amd64.signed.zip"
13+
}
14+
}

.gon-arm64.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"source": ["./dist/macos-arm64_darwin_arm64/baton-github"],
3+
"bundle_id": "com.conductorone.baton-github",
4+
"apple_id": {
5+
"username" : "[email protected]",
6+
"password": "@env:AC_PASSWORD"
7+
},
8+
"sign": {
9+
"application_identity": "Developer ID Application: Justin Gallardo (858DKH55XL)"
10+
},
11+
"zip" :{
12+
"output_path": "./dist/baton-github-darwin-arm64.signed.zip"
13+
}
14+
}

.goreleaser.docker.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
project_name: baton-github
2+
builds:
3+
- binary: baton-github
4+
env:
5+
- CGO_ENABLED=0
6+
id: linux
7+
main: ./cmd
8+
goos:
9+
- linux
10+
goarch:
11+
- amd64
12+
- arm64
13+
dockers:
14+
- use: buildx
15+
goos: linux
16+
goarch: amd64
17+
image_templates:
18+
- "ghcr.io/conductorone/baton-github:{{ .Version }}-amd64"
19+
- "ghcr.io/conductorone/baton-github:latest-amd64"
20+
build_flag_templates:
21+
- "--platform=linux/amd64"
22+
- "--label=org.opencontainers.image.created={{.Date}}"
23+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
24+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
25+
- "--label=org.opencontainers.image.version={{.Version}}"
26+
- use: buildx
27+
goos: linux
28+
goarch: arm64
29+
image_templates:
30+
- "ghcr.io/conductorone/baton-github:{{ .Version }}-arm64"
31+
- "ghcr.io/conductorone/baton-github:latest-arm64"
32+
build_flag_templates:
33+
- "--platform=linux/arm64/v8"
34+
- "--label=org.opencontainers.image.created={{.Date}}"
35+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
36+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
37+
- "--label=org.opencontainers.image.version={{.Version}}"
38+
docker_manifests:
39+
- name_template: ghcr.io/conductorone/baton-github:{{ .Version }}
40+
image_templates:
41+
- ghcr.io/conductorone/baton-github:{{ .Version }}-amd64
42+
- ghcr.io/conductorone/baton-github:{{ .Version }}-arm64
43+
- name_template: ghcr.io/conductorone/baton-github:latest
44+
image_templates:
45+
- ghcr.io/conductorone/baton-github:latest-amd64
46+
- ghcr.io/conductorone/baton-github:latest-arm64
47+
checksum:
48+
disable: true
49+
release:
50+
disable: true
51+
changelog:
52+
skip: true

0 commit comments

Comments
 (0)