Skip to content

Commit

Permalink
fix: [#25] Run integration tests in action. (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbp-bvanb committed Feb 12, 2024
1 parent 0d0180b commit 50063b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ and a [.golangci.yml](https://golangci-lint.run/usage/configuration/).

## integration

In order to run integration tests ensure that the code resides in a file with
a `_integration_test.go` postfix, e.g., `some_integration_test.go` and add the
following header:
To execute integration tests, make sure that the code is located in a file with
a `_integration_test.go` postfix, such as `some_integration_test.go`.
Additionally, include the following header in the file:

```bash
//go:build integration
```

Once this has been added and `go test ./... --tags=integration` is issued like
in this action, both unit and integration tests will be run. If the `--tags`
step is omitted, only unit tests will be run.
After adding this header, issue the command `go test ./... --tags=integration`
as demonstrated in this example. This action will run both unit and integration
tests. If the `--tags` step is omitted, only unit tests will be executed.
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ runs:
shell: bash
run: |
go test \
-p ${{ inputs.golang-number-of-tests-in-parallel }} \
-race \
-short \
-v \
$(go list ./... | grep -v '${{ inputs.golang-unit-tests-exclusions }}')
#
# Both unit and integration tests including code coverage.
#
- name: unit & integrations tests and code coverage
shell: bash
run: |
go test \
--tags=integration \
-cover \
-covermode=atomic \
-coverprofile=coverage.txt \
Expand Down

0 comments on commit 50063b7

Please sign in to comment.