Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix CircleCI docs #2539

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 49 additions & 8 deletions docs/system_requirements/ci/circle_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,59 @@
Your CircleCI configuration should use a dedicated VM for Testcontainers to work. You can achieve this by specifying the
executor type in your `.circleci/config.yml` to be `machine` instead of the default `docker` executor (see [Choosing an Executor Type](https://circleci.com/docs/executor-intro/) for more info).

Here is a sample CircleCI configuration that does a checkout of a project and runs Maven:
Here is a sample CircleCI configuration that does a checkout of a project and runs `go test` for a project. Go is installed for the `tests` job using [`gvm`](https://github.com/andrewkroh/gvm), and a workflow matrix has been defined to run the job with different Go versions. Go steps are finally executed from the `go` orb.

```yml
version: 2.1

orbs:
go: circleci/go@1.11.0

executors:
machine_executor_amd64:
machine:
image: ubuntu-2204:2024.01.2
environment:
architecture: "amd64"
platform: "linux/amd64"

jobs:
build:
# Check https://circleci.com/docs/executor-intro#linux-vm for more details
machine: true
image: ubuntu-2204:2023.04.2
tests:
executor: machine_executor_amd64
parameters:
go-version:
type: string
steps:
# install Go 1.x
# checkout the project
- run: go test./...
- run:
name: Install GVM
command: |
mkdir ~/gvmbin
curl -sL -o ~/gvmbin/gvm https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-linux-amd64
chmod +x ~/gvmbin/gvm
echo 'export PATH=$PATH:~/gvmbin' >> "$BASH_ENV"
- run:
name: Install Go
command: |
eval "$(gvm << parameters.go-version >>)"
echo 'eval "$(gvm << parameters.go-version >>)"' >> "$BASH_ENV"
go version
- checkout # checkout source code
- go/load-cache # Load cached Go modules.
- go/mod-download # Run 'go mod download'.
- go/save-cache # Save Go modules to cache.
- go/test: # Runs 'go test ./...' but includes extensive parameterization for finer tuning.
covermode: atomic
failfast: true
race: true

workflows:
build-and-test:
jobs:
- tests:
matrix:
parameters:
go-version: ["1.21.7", "1.22.3"]

```

You can learn more about the best practices of using Testcontainers together with CircleCI in [this article](https://www.atomicjar.com/2022/12/testcontainers-with-circleci/) for Java.