Skip to content

Commit

Permalink
chore: format using Make (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo authored Sep 22, 2022
1 parent be24b80 commit 15cdb88
Show file tree
Hide file tree
Showing 18 changed files with 651 additions and 600 deletions.
1 change: 0 additions & 1 deletion .bin/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ jobs:
- run: go list -json > go.list
- name: Run nancy
uses: sonatype-nexus-community/nancy-github-action@v1.0.2
- name: Run prettier
uses: ory/ci/prettier@master
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
env:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Format

on:
pull_request:
push:

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- run: make format
- name: Indicate formatting issues
run: git diff HEAD --exit-code --color
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.bin/
.idea/
node_modules/
*.iml
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.schema
.snapshots
CHANGELOG.md
spec
fixtures
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export PATH := .bin:${PATH}
export PWD := $(shell pwd)

GO_DEPENDENCIES = github.com/ory/go-acc \
golang.org/x/tools/cmd/goimports \
github.com/golang/mock/mockgen \
github.com/go-swagger/go-swagger/cmd/swagger \
github.com/go-bindata/go-bindata/go-bindata
Expand All @@ -21,8 +20,9 @@ endef

$(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))

node_modules: package.json
node_modules: package-lock.json
npm ci
touch node_modules

.PHONY: .bin/yq
.bin/yq:
Expand All @@ -34,6 +34,9 @@ node_modules: package.json
docs/cli: .bin/clidoc
clidoc .

.bin/goimports: go.sum Makefile
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest

.bin/ory: Makefile
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -d -b .bin ory v0.1.22
touch -a -m .bin/ory
Expand Down Expand Up @@ -89,8 +92,8 @@ quicktest-hsm:
# Formats the code
.PHONY: format
format: .bin/goimports node_modules
goimports -w --local github.com/ory .
npm run format
.bin/goimports -w --local github.com/ory .
npm exec -- prettier --write .

# Generates mocks
.PHONY: mocks
Expand Down
Loading

0 comments on commit 15cdb88

Please sign in to comment.