CircleCI→GitHub Actions (#740)

* CircleCI→GitHub Actions
* Fix gofmt files
This commit is contained in:
Jesse Peterson
2021-04-21 20:51:39 -07:00
committed by GitHub
parent 974ba0d206
commit ef5d879d27
10 changed files with 55 additions and 41 deletions

View File

@@ -1,27 +0,0 @@
version: 2
jobs:
build-go1.11:
docker:
- image: golang:1.11
- image: postgres:9.6
environment:
POSTGRES_DB: micromdm
POSTGRES_USER: micromdm
POSTGRES_PASSWORD: micromdm
working_directory: /go/src/github.com/micromdm/micromdm
steps: &steps
- checkout
- run: apt-get update -y && apt-get install postgresql-client -y
- run: make deps
- run: GO111MODULE=on go install github.com/pressly/goose/cmd/goose
- run: make db-reset-test
- run: make db-migrate-test
- run: make test
- run: make
workflows:
version: 2
build:
jobs:
- build-go1.11

33
.github/workflows/CI.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
types: [opened, reopened, synchronize]
jobs:
build-test:
name: Build, test & format
strategy:
matrix:
go-version: [1.15.x, 1.16.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Format
if: matrix.platform == 'ubuntu-latest'
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi

View File

@@ -58,6 +58,10 @@ deps: gomodcheck
@go mod download
test:
go test -cover ./...
# don't run race tests by default. see https://github.com/etcd-io/bbolt/issues/187
test-race:
go test -cover -race ./...
build: micromdm mdmctl

View File

@@ -164,12 +164,12 @@ func (cmd *mdmcertCommand) runPush(args []string) error {
flagset := flag.NewFlagSet("push", flag.ExitOnError)
flagset.Usage = usageFor(flagset, "mdmctl mdmcert push [flags]")
var (
flEmail = flagset.String("email", "", "Email address to use in CSR Subject.")
flCountry = flagset.String("country", "US", "Two letter country code for the CSR Subject(Example: US).")
flCN = flagset.String("cn", "micromdm-user", "CommonName for the CSR Subject.")
flPKeyPass = flagset.String("password", "", "Password to encrypt/read the RSA key.")
flKeyPath = flagset.String("private-key", filepath.Join(mdmcertdir, pushCertificatePrivateKeyFilename), "Path to the push certificate private key. A new RSA key will be created at this path.")
flLocalOnly= flagset.Bool("local-only",false,"No server configuration required.")
flEmail = flagset.String("email", "", "Email address to use in CSR Subject.")
flCountry = flagset.String("country", "US", "Two letter country code for the CSR Subject(Example: US).")
flCN = flagset.String("cn", "micromdm-user", "CommonName for the CSR Subject.")
flPKeyPass = flagset.String("password", "", "Password to encrypt/read the RSA key.")
flKeyPath = flagset.String("private-key", filepath.Join(mdmcertdir, pushCertificatePrivateKeyFilename), "Path to the push certificate private key. A new RSA key will be created at this path.")
flLocalOnly = flagset.Bool("local-only", false, "No server configuration required.")
flCSRPath = flagset.String("out", filepath.Join(mdmcertdir, pushCSRFilename), "Path to save the MDM Push Certificate request.")
)
@@ -178,10 +178,10 @@ func (cmd *mdmcertCommand) runPush(args []string) error {
return err
}
if !*flLocalOnly {
if err := cmd.setup(); err != nil {
return err
}
if !*flLocalOnly {
if err := cmd.setup(); err != nil {
return err
}
}
if err := os.MkdirAll(filepath.Dir(*flCSRPath), 0755); err != nil {
errors.Wrapf(err, "create directory %s", filepath.Dir(*flCSRPath))

View File

@@ -217,7 +217,7 @@ type Setting struct {
DeviceName *string `plist:",omitempty" json:"device_name,omitempty"`
HostName *string `plist:",omitempty" json:"hostname,omitempty"`
Identifier *string `plist:",omitempty" json:"identifier"`
TimeZone *string `plist:",omitempty" json:"time_zone,omitempty"`
TimeZone *string `plist:",omitempty" json:"time_zone,omitempty"`
Attributes map[string]string `plist:",omitempty" json:"attributes,omitempty"`
Image []byte `plist:",omitempty" json:"image,omitempty"`
Where *int `plist:",omitempty" json:"where,omitempty"`

View File

@@ -441,7 +441,7 @@ func settingToProto(s Setting) *mdmproto.Setting {
pbs.TimeZone = &mdmproto.TimeZoneSetting{
TimeZone: emptyStringIfNil(s.TimeZone),
}
case "HostName":
case "HostName":
pbs.Hostname = &mdmproto.HostnameSetting{
Hostname: emptyStringIfNil(s.HostName),
}

View File

@@ -1,3 +1,5 @@
// +build pg
package pg
import (

View File

@@ -136,7 +136,7 @@ func newClient(cert tls.Certificate) (*http.Client, error) {
}
config.BuildNameToCertificate()
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: config,
IdleConnTimeout: 90 * time.Second,
}

View File

@@ -43,7 +43,7 @@ func MarshalBlueprint(bp *Blueprint) ([]byte, error) {
UserUuid: bp.UserUUID,
SkipPrimarySetupAccountCreation: bp.SkipPrimarySetupAccountCreation,
SetPrimarySetupAccountAsRegularUser: bp.SetPrimarySetupAccountAsRegularUser,
ApplyAt: bp.ApplyAt,
ApplyAt: bp.ApplyAt,
}
return proto.Marshal(&protobp)
}

View File

@@ -1,3 +1,5 @@
// +build pg
package pg
import (