From 549aa1f974b264e171709012920d33dde138e5d0 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Wed, 1 Dec 2021 15:46:25 -0800 Subject: [PATCH 1/8] add CI config --- .circleci/config.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..e69de29 From f579de6c779044e7fc8963a86fb7f2cd9aefa005 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Wed, 1 Dec 2021 15:47:38 -0800 Subject: [PATCH 2/8] add CI config with actual stuff in file --- .circleci/config.yml | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e69de29..0c3f044 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 + From 5fa61d8b7ef188994187059a89b314c6dc0f6f49 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 12:11:26 -0800 Subject: [PATCH 3/8] uncomment integration tests line --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c3f044..1783a05 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,9 +34,9 @@ jobs: # basic units of work in a run - 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 + - run: + name: Run unit and integration tests + command: make test | tee ${TEST_RESULTS}/go-test.out - store_artifacts: path: spec/pacts destination: /pacts From 95406a67bfdf8ab45a5ede002e9da9aa5791d8e3 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 12:14:42 -0800 Subject: [PATCH 4/8] remove testing in makefile --- .circleci/config.yml | 6 +++--- Makefile | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1783a05..0c3f044 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,9 +34,9 @@ jobs: # basic units of work in a run - 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 + # - run: + # name: Run unit and integration tests + # command: make test | tee ${TEST_RESULTS}/go-test.out - store_artifacts: path: spec/pacts destination: /pacts diff --git a/Makefile b/Makefile index a4a1817..9d76394 100644 --- a/Makefile +++ b/Makefile @@ -31,25 +31,25 @@ build-race: # Testing # ########### -test-unit: - ./hack/run-test-unit.sh -.PHONY: test-unit +# 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 # From 4b25481fbeb55602a428091da8eebfde721a60b8 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 12:18:29 -0800 Subject: [PATCH 5/8] change make all command --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d76394..a6b7edd 100644 --- a/Makefile +++ b/Makefile @@ -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-race .PHONY: all # When running integration tests on windows machine From 4c2a624850821986b6103798380b4cf96304adbd Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 12:21:18 -0800 Subject: [PATCH 6/8] remove action on pull requests --- .github/workflows/pull-requests.yml | 71 ----------------------------- 1 file changed, 71 deletions(-) delete mode 100644 .github/workflows/pull-requests.yml diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml deleted file mode 100644 index f4356b2..0000000 --- a/.github/workflows/pull-requests.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Pull request - -on: - pull_request: - branches: [ main ] - -env: - GO111MODULE: on - INSTALL_DEPS: true - -defaults: - run: - shell: bash - -jobs: - unit-test: - strategy: - fail-fast: false - matrix: - go-version: [ 1.17.x ] - os: [ ubuntu-latest, macos-latest ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: "Build and unit-test with Go ${{ matrix.go-version }}" - run: make test-unit - - name: "Hammer unit-test with ${{ matrix.go-version }}" - run: make test-hammer - code-quality-test: - strategy: - fail-fast: false - matrix: - go-version: [ 1.17.x ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: "Code Quality Analysis" - run: make test-lint - integration-test: - strategy: - fail-fast: false - matrix: - go-version: [ 1.17.x ] - os: [ ubuntu-latest, macos-latest, windows-latest ] - runs-on: ${{ matrix.os }} - steps: - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - if: matrix.os == 'windows-latest' - run: echo "BINARY_EXT=.exe" >> $GITHUB_ENV - - name: "Integration testing with ${{ matrix.go-version }}" - env: - GITHUB_TOKEN: ${{ secrets.TOKEN_INTEGRATION_TESTS }} - run: | - echo "${{ env.BINARY_PATH }}" - make test-integration From d6afe8b1bdc2b2a20542905187bae557705842fa Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 13:18:47 -0800 Subject: [PATCH 7/8] just normal build --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a6b7edd..ff5a5b2 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ export GO111MODULE = on export GOPROXY = https://proxy.golang.org # all: build-race test-unit test-integration test-lint -all: build-race +all: build .PHONY: all # When running integration tests on windows machine @@ -24,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 # From 09d77b780641ed8b1d7314c9d39ef0fdd7a25709 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Thu, 2 Dec 2021 13:30:53 -0800 Subject: [PATCH 8/8] just try unit tests --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ff5a5b2..392fbaa 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,9 @@ build: # Testing # ########### -# test-unit: -# ./hack/run-test-unit.sh -# .PHONY: test-unit +test-unit: + ./hack/run-test-unit.sh +.PHONY: test-unit # test-integration: build # ./hack/run-test-integration.sh