Skip to content

Commit

Permalink
docs: fix CircleCI docs (#2539)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya authored May 16, 2024
1 parent df8c549 commit 7eb1c07
Showing 1 changed file with 49 additions and 8 deletions.
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.

0 comments on commit 7eb1c07

Please sign in to comment.