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

tools: Organize our config files and tooling. #336

Merged
merged 1 commit into from
Apr 14, 2022
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
25 changes: 12 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ version: 2.1
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:

# Job builds and runs all the test.
build:
working_directory: ~/repo
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: circleci/golang:1.17.5
# https://circleci.com/developer/images/image/cimg/go
- image: cimg/go:1.17
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: make deps
name: Install go modules into the module cache.
command: make deps:modules
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
Expand All @@ -36,22 +36,22 @@ jobs:
DEFRA_MAP: true
- store_test_results:
path: /tmp/test-reports

# Job detects if we have a change.
change_detection:
working_directory: ~/repo
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: circleci/golang:1.17.5
# https://circleci.com/developer/images/image/cimg/go
- image: cimg/go:1.17
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: make deps
name: Install go modules into the module cache.
command: make deps:modules
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
Expand All @@ -67,7 +67,6 @@ jobs:
path: /tmp/test-reports

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build-test: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/lint-then-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
# exist or not doesn't matter). But the good think is that the annotations
# will still show up. I think this can be useful if we don't want the pipeline
# to stop just because we had some linter errors.
args: --issues-exit-code=1 --config .golangci.sourceinc.yaml
args: --issues-exit-code=1 --config tools/configs/golangci.yaml

# Optional: we can set the below to `true` if we only want to see newly
# introduced linter errors, however I found that in practive that option is a
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
make deps:bench &&
cp bench-artifact-${{ steps.last_successful_upload_on_develop.outputs.commit_hash }}.txt develop.txt &&
${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt | sed -n "/<body>/,/<\/body>/p" > comparison.html &&
./tools/pretty-benchstat-html.sh comparison.html > pretty-comparison.md
./tools/scripts/pretty-benchstat-html.sh comparison.html > pretty-comparison.md

- name: Comment Benchmark Results on PR
if: |
Expand Down
35 changes: 23 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,29 @@ dump: build
deps\:lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin latest

.PHONY: deps\:go-acc
deps\:go-acc:
.PHONY: deps\:coverage
deps\:coverage:
go install github.com/ory/go-acc@latest

.PHONY: deps\:go-lines
deps\:go-lines:
go install github.com/segmentio/golines@latest

.PHONY: deps\:bench
deps\:bench:
go install golang.org/x/perf/cmd/benchstat@latest

.PHONY: deps
deps: deps\:lint deps\:go-acc deps\:bench
.PHONY: deps\:golines
deps\:golines:
go install github.com/segmentio/golines@latest

.PHONY: deps\:chglog
deps\:chglog:
go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest

.PHONY: deps\:modules
deps\:modules:
go mod download

.PHONY: deps
deps: deps\:lint deps\:coverage deps\:bench deps\:golines deps\:chglog deps\:modules

.PHONY: tidy
tidy:
go mod tidy
Expand Down Expand Up @@ -74,7 +81,7 @@ test\:bench-short:

# This also takes integration tests into account.
.PHONY: test\:coverage-full
test\:coverage-full: deps\:go-acc
test\:coverage-full: deps\:coverage
go-acc ./... --output=coverage-full.txt --covermode=atomic
go tool cover -func coverage-full.txt | grep total | awk '{print $$3}'

Expand All @@ -90,16 +97,20 @@ test\:changes:

.PHONY: validate\:codecov
validate\:codecov:
curl --data-binary @codecov.yml https://codecov.io/validate
curl --data-binary @.github/codecov.yml https://codecov.io/validate

.PHONY: lint
lint:
golangci-lint run --config .golangci.sourceinc.yaml
golangci-lint run --config tools/configs/golangci.yaml

.PHONY: lint\:todo
lint\:todo:
rg "nolint" -g '!{Makefile}'

.PHONY: lint\:list
lint\:list:
golangci-lint linters --config .golangci.sourceinc.yaml
golangci-lint linters --config tools/configs/golangci.yaml

.PHONY: chglog
chglog:
git-chglog -c "tools/configs/chglog/config.yml" --next-tag v0.x.0 -o CHANGELOG.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.