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

add CI config #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
57 changes: 57 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 2
jobs: # basic units of work in a run
build: # runs not using Workflows must have a `build` job as entry point
environment:
TEST_RESULTS: /tmp/test-results
DATABASE_URL: "postgres://stitchfix_owner:@localhost/circle_test?sslmode=disable"
TRANSMETROPOLITAN_ENG_REPLICA_DATABASE_URL: "postgres://stitchfix_owner:@localhost/codeowners_validator"
PORT: 3000
GOLANGCI_LINT_VERSION: "v1.42.1"
docker: # run the steps with Docker
- image: cimg/golang:1.17
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
- image: postgres:9.6
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment:
- POSTGRES_USER: stitchfix_owner
- POSTGRES_DB: circle_test
- POSTGRES_HOST_AUTH_METHOD: "trust"
steps:
- stitchfix_build/eng_go_dependency_auth
- checkout
- run: mkdir -p $TEST_RESULTS
- run: go mod download
- run:
name: Install golangci-lint
command: wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /home/circleci/go/bin $GOLANGCI_LINT_VERSION
- run: make lint
- run: sudo apt update
- run: sudo apt install postgresql-client
- run: make tools
- run: make all
- run: goose -dir migrations postgres $DATABASE_URL up
# - run:
# name: Run unit and integration tests
# command: make test | tee ${TEST_RESULTS}/go-test.out
- store_artifacts:
path: spec/pacts
destination: /pacts
- stitchfix_build/notify_ci_completed

orbs:
stitchfix_build: stitchfix/build@dev:master
stitchfix_security: stitchfix/security@dev:master

workflows:
version: 2
on-commit:
jobs:
- build:
context: org-global
- stitchfix_security/eng_ruby_checks:
context: org-global

71 changes: 0 additions & 71 deletions .github/workflows/pull-requests.yml

This file was deleted.

33 changes: 17 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export GO111MODULE = on
# enable consistent Go 1.12/1.13 GOPROXY behavior.
export GOPROXY = https://proxy.golang.org

all: build-race test-unit test-integration test-lint
# all: build-race test-unit test-integration test-lint
all: build
.PHONY: all

# When running integration tests on windows machine
Expand All @@ -23,9 +24,9 @@ build:
go build -o $(BINARY_PATH) ./main.go
.PHONY: build

build-race:
go build -race -o codeowners-validator ./main.go
.PHONY: build-race
# build-race:
# go build -race -o codeowners-validator ./main.go
# .PHONY: build-race

###########
# Testing #
Expand All @@ -35,21 +36,21 @@ test-unit:
./hack/run-test-unit.sh
.PHONY: test-unit

test-integration: build
./hack/run-test-integration.sh
.PHONY: test-integration
# test-integration: build
# ./hack/run-test-integration.sh
# .PHONY: test-integration

test-lint:
./hack/run-lint.sh
.PHONY: test-lint
# test-lint:
# ./hack/run-lint.sh
# .PHONY: test-lint

test-hammer:
go test -count=100 ./...
.PHONY: test-hammer
# test-hammer:
# go test -count=100 ./...
# .PHONY: test-hammer

test-unit-cover-html: test-unit
go tool cover -html=./coverage.txt
.PHONY: cover-html
# test-unit-cover-html: test-unit
# go tool cover -html=./coverage.txt
# .PHONY: cover-html

###############
# Development #
Expand Down