forked from magma/magma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[orc8r][ci] Enforce go fmt on PRs (magma#4149)
Signed-off-by: Hunter Gatewood <[email protected]>
- Loading branch information
1 parent
b83f748
commit 51843e3
Showing
181 changed files
with
759 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,14 +34,27 @@ executors: | |
orbs: | ||
artifactory: circleci/[email protected] | ||
|
||
python: | ||
commands: | ||
set_version: | ||
parameters: | ||
python_version: | ||
description: Valid Python version to set | ||
type: string | ||
default: "3.7.0" | ||
steps: | ||
- run: | ||
name: Set Python version | ||
command: pyenv global <<parameters.python_version>> | ||
|
||
docker: | ||
commands: | ||
install-dc: | ||
parameters: | ||
compose_version: | ||
description: Docker-compose version to install | ||
type: string | ||
default: '1.25.4' | ||
default: "1.25.4" | ||
steps: | ||
- run: | ||
name: Install Docker Compose | ||
|
@@ -268,9 +281,7 @@ commands: | |
echo export AWS_DEFAULT_REGION="us-east-1" >> $BASH_ENV | ||
echo export AWS_ACCESS_KEY_ID="$(printenv MAGMA_DEPLOY_AWS_ACCESS_KEY_ID)" >> $BASH_ENV | ||
echo export AWS_SECRET_ACCESS_KEY="$(printenv MAGMA_DEPLOY_AWS_SECRET_ACCESS_KEY)" >> $BASH_ENV | ||
- run: | ||
name: Select python 3.7.0 | ||
command: pyenv global 3.7.0 | ||
- python/set_version | ||
- run: | ||
name: Install python prerequisites | ||
command: pip3 install fabric3 jsonpickle requests PyYAML awscli | ||
|
@@ -444,16 +455,35 @@ jobs: | |
- build/determinator: | ||
<<: *all_gateways_build_verify | ||
- docker/install-dc | ||
- run: | ||
name: "Set Python Version" | ||
command: pyenv global 3.7.0 | ||
- python/set_version | ||
- run: | ||
command: | | ||
cd ${MAGMA_ROOT}/orc8r/cloud/docker | ||
python3 build.py -t -l | ||
python3 build.py --tests --up | ||
no_output_timeout: 15m | ||
- magma_slack_notify | ||
|
||
# Fail if code doesn't pass formatting requirements. | ||
cloud_lint: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
docker_layer_caching: true | ||
environment: | ||
MAGMA_ROOT: /home/circleci/project | ||
steps: | ||
- checkout | ||
- build/determinator: | ||
<<: *all_gateways_build_verify | ||
- python/set_version | ||
- run: | ||
name: Lint cloud Go code | ||
command: | | ||
cd ${MAGMA_ROOT}/orc8r/cloud/docker | ||
python3 build.py --lint | ||
- magma_slack_notify | ||
|
||
# Fail if checked-in generated code doesn't match output from | ||
# generation command. | ||
insync-checkin: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
|
@@ -466,13 +496,11 @@ jobs: | |
<<: *all_gateways_build_verify | ||
- docker/install-dc | ||
- run: sudo apt-get update | ||
- run: | ||
name: "Set Python Version" | ||
command: pyenv global 3.7.0 | ||
- python/set_version | ||
- run: | ||
command: | | ||
cd ${MAGMA_ROOT}/orc8r/cloud/docker | ||
python3 build.py -g | ||
python3 build.py --generate | ||
- run: sudo chown -R circleci $MAGMA_ROOT/* | ||
- run: git add . | ||
- run: git status | ||
|
@@ -492,13 +520,11 @@ jobs: | |
<<: *all_gateways_build_verify | ||
- docker/install-dc | ||
- run: sudo apt-get update | ||
- run: | ||
name: "Set Python Version" | ||
command: pyenv global 3.7.0 | ||
- python/set_version | ||
- run: | ||
command: | | ||
cd ${MAGMA_ROOT}/orc8r/cloud/docker | ||
python3 build.py -a --nocache --parallel | ||
python3 build.py --all --nocache --parallel | ||
- tag-push-docker: | ||
project: orc8r | ||
images: "nginx|controller" | ||
|
@@ -987,12 +1013,14 @@ workflows: | |
|
||
cloud: | ||
jobs: | ||
- cloud-test | ||
- insync-checkin | ||
- cloud_lint | ||
- cloud-test | ||
- orc8r-build: | ||
requires: | ||
- cloud-test | ||
- insync-checkin | ||
- cloud_lint | ||
- cloud-test | ||
|
||
lib_gateway: | ||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Ref: https://editorconfig.org/ | ||
# IntelliJ-specific: https://blog.jetbrains.com/idea/2019/06/managing-code-style-on-a-directory-level-with-editorconfig/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
ij_visual_guides = 79,140 | ||
|
||
[{*.go,*.go2}] | ||
indent_style = tab | ||
ij_go_add_leading_space_to_comments = true | ||
ij_go_add_parentheses_for_single_import = true | ||
ij_go_call_parameters_new_line_after_left_paren = true | ||
ij_go_call_parameters_right_paren_on_new_line = true | ||
ij_go_group_current_project_imports = true | ||
ij_go_group_stdlib_imports = true | ||
ij_go_import_sorting = goimports | ||
ij_go_keep_indents_on_empty_lines = false | ||
ij_go_move_all_imports_in_one_declaration = true | ||
ij_go_move_all_stdlib_imports_in_one_group = true | ||
ij_go_remove_redundant_import_aliases = true | ||
ij_go_use_back_quotes_for_imports = false | ||
ij_go_wrap_func_params_newline_after_lparen = true | ||
ij_go_wrap_func_params_newline_before_rparen = true | ||
ij_go_wrap_func_result_newline_after_lparen = true | ||
ij_go_wrap_func_result_newline_before_rparen = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# golangci-lint settings. | ||
# Ref: https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml | ||
|
||
run: | ||
timeout: 7m | ||
skip-dirs: | ||
- '.*/migrations/.*' | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: true | ||
misspell: | ||
locale: US | ||
|
||
issues: | ||
exclude-rules: | ||
- linters: | ||
- staticcheck | ||
# Ignore: | ||
# - deprecation warnings | ||
# - unconditional loop termination | ||
text: "SA1019:|SA4004:" | ||
|
||
# Ref: https://golangci-lint.run/usage/linters/ | ||
linters: | ||
# Whitelist-only (disable default set of linters) | ||
disable-all: true | ||
enable: | ||
- exportloopref | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- predeclared | ||
- rowserrcheck | ||
- staticcheck | ||
- typecheck | ||
- unconvert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project version="4"> | ||
<component name="ProjectTasksOptions"> | ||
<TaskOptions isEnabled="true"> | ||
<option name="arguments" value="-s -w $FilePath$" /> | ||
<option name="checkSyntaxErrors" value="true" /> | ||
<option name="description" /> | ||
<option name="exitCodeBehavior" value="ERROR" /> | ||
<option name="fileExtension" value="go" /> | ||
<option name="immediateSync" value="false" /> | ||
<option name="name" value="gofmt" /> | ||
<option name="output" value="$FilePath$" /> | ||
<option name="outputFilters"> | ||
<array /> | ||
</option> | ||
<option name="outputFromStdout" value="false" /> | ||
<option name="program" value="gofmt" /> | ||
<option name="runOnExternalChanges" value="false" /> | ||
<option name="scopeName" value="Project Files" /> | ||
<option name="trackOnlyRoot" value="true" /> | ||
<option name="workingDir" value="$ProjectFileDir$" /> | ||
<envs> | ||
<env name="GOROOT" value="$GOROOT$" /> | ||
<env name="GOPATH" value="$GOPATH$" /> | ||
<env name="PATH" value="$GoBinDirs$" /> | ||
</envs> | ||
</TaskOptions> | ||
<TaskOptions isEnabled="true"> | ||
<option name="arguments" value="-w $FilePath$" /> | ||
<option name="checkSyntaxErrors" value="true" /> | ||
<option name="description" /> | ||
<option name="exitCodeBehavior" value="ERROR" /> | ||
<option name="fileExtension" value="go" /> | ||
<option name="immediateSync" value="false" /> | ||
<option name="name" value="goimports" /> | ||
<option name="output" value="$FilePath$" /> | ||
<option name="outputFilters"> | ||
<array /> | ||
</option> | ||
<option name="outputFromStdout" value="false" /> | ||
<option name="program" value="goimports" /> | ||
<option name="runOnExternalChanges" value="false" /> | ||
<option name="scopeName" value="Project Files" /> | ||
<option name="trackOnlyRoot" value="true" /> | ||
<option name="workingDir" value="$ProjectFileDir$" /> | ||
<envs> | ||
<env name="GOROOT" value="$GOROOT$" /> | ||
<env name="GOPATH" value="$GOPATH$" /> | ||
<env name="PATH" value="$GoBinDirs$" /> | ||
</envs> | ||
</TaskOptions> | ||
<TaskOptions isEnabled="true"> | ||
<option name="arguments" value="fmt $FilePath$" /> | ||
<option name="checkSyntaxErrors" value="true" /> | ||
<option name="description" /> | ||
<option name="exitCodeBehavior" value="ERROR" /> | ||
<option name="fileExtension" value="tf" /> | ||
<option name="immediateSync" value="false" /> | ||
<option name="name" value="terraform fmt" /> | ||
<option name="output" value="$FilePath$" /> | ||
<option name="outputFilters"> | ||
<array /> | ||
</option> | ||
<option name="outputFromStdout" value="false" /> | ||
<option name="program" value="$TerraformExecPath$" /> | ||
<option name="runOnExternalChanges" value="false" /> | ||
<option name="scopeName" value="Project Files" /> | ||
<option name="trackOnlyRoot" value="true" /> | ||
<option name="workingDir" value="" /> | ||
<envs /> | ||
</TaskOptions> | ||
</component> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="go test orc8r/lib" type="GoTestRunConfiguration" factoryName="Go Test"> | ||
<module name="magma" /> | ||
<working_directory value="$PROJECT_DIR$/orc8r/lib/go" /> | ||
<framework value="gotest" /> | ||
<kind value="DIRECTORY" /> | ||
<directory value="$PROJECT_DIR$/orc8r/lib/go" /> | ||
<filePath value="$PROJECT_DIR$" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.