-
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 #1 from jfelipearaujo/feat/pkg-structure
Feat/pkg structure
- Loading branch information
Showing
47 changed files
with
5,390 additions
and
1 deletion.
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,32 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
- 'v*.*.*-*.*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22.x' | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5.0.0 | ||
with: | ||
distribution: goreleaser | ||
version: ${{ env.GITHUB_REF_NAME }} | ||
args: release --clean | ||
workdir: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,28 @@ | ||
name: tests | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: [1.22.x] | ||
tests: [1, 2, 3, 4, 5, 6] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Run Tests 0${{ matrix.tests }} | ||
run: make run-tests-0${{ matrix.tests }} |
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,37 @@ | ||
output: "{{.Dir}}/README.md" | ||
header: |- | ||
# testcontainers | ||
This is an addon to be used with Testcontainers package and with GoDog | ||
## Installation | ||
```bash | ||
go get github.com/jfelipearaujo/testcontainers@latest | ||
``` | ||
## How to use | ||
To use this addon, you need to import the packages in your project: | ||
```go | ||
import "github.com/jfelipearaujo/testcontainers/pkg/container" | ||
import "github.com/jfelipearaujo/testcontainers/pkg/network" | ||
import "github.com/jfelipearaujo/testcontainers/pkg/state" | ||
import "github.com/jfelipearaujo/testcontainers/pkg/testsuite" | ||
``` | ||
# Examples | ||
| Example | Description | | ||
| --- | --- | | ||
| [Example 01](./examples/example_01/README.md) | Simple BDD test. | ||
| [Example 02](./examples/example_02/README.md) | Using a Postgres container. | ||
| [Example 03](./examples/example_03/README.md) | Using aLocalStack container. | ||
| [Example 04](./examples/example_04/README.md) | Using a MongoDB container. | ||
| [Example 05](./examples/example_05/README.md) | Custom API running on a container via Dockerfile. | ||
| [Example 06](./examples/example_06/README.md) | Two containers interacting with each other using a Network. | ||
# Full documentation | ||
repository: | ||
url: https://github.com/jfelipearaujo/testcontainers | ||
defaultBranch: main | ||
path: / |
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,69 @@ | ||
TAG := $(shell git describe --tags --abbrev=0 2>/dev/null) | ||
VERSION := $(shell echo $(TAG) | sed 's/v//') | ||
|
||
tag: | ||
@if [ -z "$(TAG)" ]; then \ | ||
echo "No previous version found. Creating v1.0.0 tag..."; \ | ||
git tag v1.0.0; \ | ||
else \ | ||
echo "Previous version found: $(VERSION)"; \ | ||
read -p "Bump major version (M/m), minor version (R/r), or patch version (P/p)? " choice; \ | ||
if [ "$$choice" = "M" ] || [ "$$choice" = "m" ]; then \ | ||
echo "Bumping major version..."; \ | ||
major=$$(echo $(VERSION) | cut -d'.' -f1); \ | ||
major=$$(expr $$major + 1); \ | ||
new_version=$$major.0.0; \ | ||
elif [ "$$choice" = "R" ] || [ "$$choice" = "r" ]; then \ | ||
echo "Bumping minor version..."; \ | ||
minor=$$(echo $(VERSION) | cut -d'.' -f2); \ | ||
minor=$$(expr $$minor + 1); \ | ||
new_version=$$(echo $(VERSION) | cut -d'.' -f1).$$minor.0; \ | ||
elif [ "$$choice" = "P" ] || [ "$$choice" = "p" ]; then \ | ||
echo "Bumping patch version..."; \ | ||
patch=$$(echo $(VERSION) | cut -d'.' -f3); \ | ||
patch=$$(expr $$patch + 1); \ | ||
new_version=$$(echo $(VERSION) | cut -d'.' -f1).$$(echo $(VERSION) | cut -d'.' -f2).$$patch; \ | ||
else \ | ||
echo "Invalid choice. Aborting."; \ | ||
exit 1; \ | ||
fi; \ | ||
echo "Creating tag for version v$$new_version..."; \ | ||
git tag v$$new_version; \ | ||
fi | ||
|
||
gen-docs: | ||
@echo "Generating docs..." | ||
gomarkdoc -o README.md ./pkg/... | ||
|
||
run-tests: | ||
@echo "Running tests..." | ||
make run-tests-01 | ||
make run-tests-02 | ||
make run-tests-03 | ||
make run-tests-04 | ||
make run-tests-05 | ||
make run-tests-06 | ||
|
||
run-tests-01: | ||
@echo "Running tests for example 01..." | ||
@go test -race -count=1 ./examples/example_01/... -timeout=300s -test.v -test.run ^TestFeatures$ | ||
|
||
run-tests-02: | ||
@echo "Running tests for example 02..." | ||
@go test -race -count=1 ./examples/example_02/... -timeout=300s -test.v -test.run ^TestFeatures$ | ||
|
||
run-tests-03: | ||
@echo "Running tests for example 03..." | ||
@go test -race -count=1 ./examples/example_03/... -timeout=300s -test.v -test.run ^TestFeatures$ | ||
|
||
run-tests-04: | ||
@echo "Running tests for example 04..." | ||
@go test -race -count=1 ./examples/example_04/... -timeout=300s -test.v -test.run ^TestFeatures$ | ||
|
||
run-tests-05: | ||
@echo "Running tests for example 05..." | ||
@go test -race -count=1 ./examples/example_05/... -timeout=300s -test.v -test.run ^TestFeatures$ | ||
|
||
run-tests-06: | ||
@echo "Running tests for example 06..." | ||
@go test -race -count=1 ./examples/example_06/... -timeout=300s -test.v -test.run ^TestFeatures$ |
Oops, something went wrong.