-
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.
Merge pull request #15 from DavyJ0nes/general-maintainence
General maintainence
- Loading branch information
Showing
16 changed files
with
577 additions
and
58 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Integration Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
# Run tests. | ||
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run Integration Tests | ||
run: make integrationtest |
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,36 @@ | ||
name: Lint and Test | ||
on: [pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Vendor Dependencies | ||
run: go mod vendor | ||
|
||
- name: Run Linter | ||
run: make lint | ||
|
||
test: | ||
needs: lint | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x, 1.14.x] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: make unittest |
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,89 @@ | ||
run: | ||
concurrency: 4 | ||
timeout: 1m | ||
issues-exit-code: 1 | ||
tests: true | ||
skip-dirs-use-default: true | ||
modules-download-mode: vendor | ||
allow-parallel-runners: false | ||
|
||
|
||
output: | ||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" | ||
format: colored-line-number | ||
|
||
|
||
linters-settings: | ||
gocognit: | ||
# minimal code complexity to report, 30 by default (but we recommend 10-20) | ||
min-complexity: 10 | ||
nestif: | ||
# minimal complexity of if statements to report, 5 by default | ||
min-complexity: 4 | ||
goconst: | ||
# minimal length of string constant, 3 by default | ||
min-len: 3 | ||
# minimal occurrences count to trigger, 3 by default | ||
min-occurrences: 3 | ||
gocritic: | ||
# Which checks should be enabled; can't be combined with 'disabled-checks'; | ||
# See https://go-critic.github.io/overview#checks-overview | ||
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` | ||
# By default list of stable checks is used. | ||
|
||
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. | ||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". | ||
enabled-tags: | ||
- performance | ||
disabled-tags: | ||
- experimental | ||
|
||
settings: # settings passed to gocritic | ||
captLocal: # must be valid enabled check name | ||
paramsOnly: true | ||
rangeValCopy: | ||
sizeThreshold: 32 | ||
gocyclo: | ||
# minimal code complexity to report, 30 by default (but we recommend 10-20) | ||
min-complexity: 10 | ||
godot: | ||
# check all top-level comments, not only declarations | ||
check-all: false | ||
|
||
|
||
linters: | ||
enable: | ||
- megacheck | ||
- govet | ||
disable: | ||
- maligned | ||
- prealloc | ||
- scopelint | ||
- noctx | ||
disable-all: false | ||
presets: | ||
- bugs | ||
- unused | ||
fast: false | ||
|
||
|
||
severity: | ||
# Default value is empty string. | ||
# Set the default severity for issues. If severity rules are defined and the issues | ||
# do not match or no severity is provided to the rule this will be the default | ||
# severity applied. Severities should match the supported severity names of the | ||
# selected out format. | ||
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity | ||
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity | ||
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message | ||
default-severity: error | ||
|
||
# Default value is empty list. | ||
# When a list of severity rules are provided, severity information will be added to lint | ||
# issues. Severity rules have the same filtering capability as exclude rules except you | ||
# are allowed to specify one matcher per severity rule. | ||
# Only affects out formats that support setting severity information. | ||
rules: | ||
- linters: | ||
- dupl | ||
severity: info |
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
# Contributing | ||
|
||
<!-- vim-markdown-toc GFM --> | ||
|
||
- [Pull Requests](#pull-requests) | ||
- [Testing](#testing) | ||
- [Unit Tests](#unit-tests) | ||
- [Integration Tests](#integration-tests) | ||
|
||
<!-- vim-markdown-toc --> | ||
|
||
Thank you so much for wanting to contribute to the [stubby]() project. | ||
|
||
I built the tool to help fulfil a need that I had with simplifying | ||
testing and I hope that it helps you as well. | ||
|
||
Below I have put some requests and tips for how to request and add features | ||
and updates to the tool. | ||
|
||
## Pull Requests | ||
|
||
If you want to contribute an update or a change, could you fork the repository | ||
and then open a pull request merging your fork into the upstream. This helps | ||
to keep the history of this upstream tidy :). | ||
|
||
## Testing | ||
|
||
### Unit Tests | ||
|
||
As stubby just returns configured HTTP responses, most of the testing is handled | ||
within the [router](./router) package. | ||
|
||
Please follow the conventions used within the [router_test.go](./router/router_test.go) | ||
file and ensure that any new functionality is covered by a test, existing or | ||
newly created. | ||
|
||
### Integration Tests | ||
|
||
A Docker Image is built for stubby to make using it within other repositories easier. | ||
|
||
To help ensure the image that is provided works as expected, some integration tests | ||
are run whenever a pull request is opened. These utilise [docker-compose](https://docs.docker.com/compose) | ||
to build the stubby Docker Image and then run tests that interact with a running | ||
version of stubby. | ||
|
||
The integration tests are located in the [testing/](./testing) package. The associated Compose | ||
file can be found [here](docker-compose.test.yml). |
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.