Skip to content

Commit

Permalink
Modify golang gen to be in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed May 2, 2020
1 parent 27a953c commit ce48b6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ jobs:
steps:
- checkout
- run: docker run -t -v $(pwd):/home/repo coinbase/salus
check-generated:
machine: true
steps:
- checkout
- run: make gen
- run: git diff --exit-code

workflows:
version: 2
Expand All @@ -97,6 +103,7 @@ workflows:
requires:
- setup
- salus
- check-generated

notify:
webhooks:
Expand Down
20 changes: 9 additions & 11 deletions codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ROSETTA_SPEC_VERSION=v1.3.1
curl -L https://github.com/coinbase/rosetta-specifications/releases/download/${ROSETTA_SPEC_VERSION}/api.json -o api.json;

# Generate client + types code
GENERATOR_VERSION='v4.3.0'
GENERATOR_VERSION=v4.3.0
docker run --user "$(id -u):$(id -g)" --rm -v "${PWD}":/local \
openapitools/openapi-generator-cli:${GENERATOR_VERSION} generate \
-i /local/api.json \
Expand Down Expand Up @@ -137,13 +137,11 @@ done
# Change model files to correct package
sed "${SED_IFLAG[@]}" 's/package client/package types/g' types/*;

# Format clienterated code
gofmt -w types/;
gofmt -w client/;
gofmt -w server/;

# Ensure license correct
make add-license;

# Ensure no long lines
make shorten-lines;
# Format client generated code
docker run --rm golang:1.13 make deps; \
gofmt -w types/; \
gofmt -w client/; \
gofmt -w server/; \
gofmt -w types/; \
make add-license; \
make shorten-lines;

0 comments on commit ce48b6b

Please sign in to comment.