Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:4": {
"version": "4.1.1",
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:2b44bcb32e75d5a3c028479f7f957cf7d5e42d81761373025a8d501dd3748f88",
"integrity": "sha256:2b44bcb32e75d5a3c028479f7f957cf7d5e42d81761373025a8d501dd3748f88"
}
}
}
32 changes: 25 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go .
{
"name": "ColonyOS ",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "devcontainer",
"workspaceFolder": "/workspaces",
"postCreateCommand": "if [ -f .devcontainer/devenv.sh ]; then .devcontainer/devenv.sh; elif [ -f colonies/.devcontainer/devenv.sh ]; then colonies/.devcontainer/devenv.sh; fi"
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:2-1.27-trixie",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:4": {
"azureDnsAutoDetection": true,
"installDockerBuildx": true,
"iptablesSwitchAtRuntime": true,
"version": "latest",
"dockerDashComposeVersion": "latest",
"moby": false
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
19 changes: 0 additions & 19 deletions .devcontainer/devenv.sh

This file was deleted.

64 changes: 0 additions & 64 deletions .devcontainer/docker-compose.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .devcontainer/init-entrypoint.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .devcontainer/minio-entrypoint.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .devcontainer/timescaledb-entrypoint.sh

This file was deleted.

39 changes: 23 additions & 16 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@ name: Go

on:
push:
branches: [ main ]
branches: [ main, dev ]
pull_request:
branches: [ main ]
branches: [ main, dev ]

jobs:
# Label of the container job
runner-job:
runs-on: self-hosted
runs-on: ubuntu-latest

# Service containers to run with `runner-job`
services:
minio:
image: fclairamb/minio-github-actions
# S3 server for pkg/fs. SeaweedFS "mini" mode seeds the credentials and
# bucket from these variables and serves S3 on 8333
seaweedfs:
image: chrislusf/seaweedfs:4.47
ports:
- 9000:9000
- 9000:8333
env:
MINIO_DOMAIN: localhost
AWS_ACCESS_KEY_ID: testaccesskey
AWS_SECRET_ACCESS_KEY: testsecretkey
S3_BUCKET: test
# Label used to access the service container
postgres:
# Docker Hub image
Expand All @@ -36,10 +40,10 @@ jobs:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v7
with:
go-version: 1.25.5

Expand All @@ -50,22 +54,25 @@ jobs:
run: TZ=Europe/Stockholm make test
env:
AWS_S3_ENDPOINT: localhost:9000
AWS_S3_ACCESSKEY: minioadmin
AWS_S3_SECRETKEY: minioadmin
AWS_S3_ACCESSKEY: testaccesskey
AWS_S3_SECRETKEY: testsecretkey
AWS_S3_TLS: false
AWS_S3_SKIPVERIFY: false
AWS_S3_BUCKET: test
COLONIES_DB_USER: postgres
COLONIES_DB_PASSWORD: rFcLGNkgsNtksg6Pgtn9CumL4xXBQ7
COLONIES_DB_HOST: localhost

# Coverage runs the suite a second time, so it is limited to pushes to main
# and skipped on dev pushes and pull requests to keep those runs fast
- name: Generate coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
# Get package list excluding monitoring
PKGS=$(go list ./pkg/... | grep -v '/monitoring$' | tr '\n' ' ')
# Run tests with coverage
# Use -coverpkg to measure client package coverage through server tests
go test -p 1 -race -coverprofile=coverage.raw -covermode=atomic -coverpkg=./pkg/... $PKGS
go test -race -coverprofile=coverage.raw -covermode=atomic -coverpkg=./pkg/... $PKGS
# Filter out test utilities, mocks, and monitoring from coverage report
grep -v 'pkg/server/test_utils.go' coverage.raw | \
grep -v 'pkg/monitoring/' | \
Expand All @@ -74,8 +81,8 @@ jobs:
rm coverage.raw
env:
AWS_S3_ENDPOINT: localhost:9000
AWS_S3_ACCESSKEY: minioadmin
AWS_S3_SECRETKEY: minioadmin
AWS_S3_ACCESSKEY: testaccesskey
AWS_S3_SECRETKEY: testsecretkey
AWS_S3_TLS: false
AWS_S3_SKIPVERIFY: false
AWS_S3_BUCKET: test
Expand All @@ -84,11 +91,11 @@ jobs:
COLONIES_DB_HOST: localhost

- name: Upload coverage to Codecov
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16 changes: 13 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ The deployment docker-compose files expect `colonyos/colonies:latest`. Using a d

### Testing
```bash
make test # Run all tests (requires grc for colored output)
make github_test # Run tests without grc (for CI)
make test # Run all tests: needs Postgres on localhost:5432 (make startdb)
# and an S3 server on localhost:9000 for pkg/fs (make starts3)
make github_test # Alias for test (used by CI)
```

Set a timezone when running tests, e.g. `export TZ=Europe/Stockholm` (the
database layer refuses to connect without TZ, and one core test expects a
non-UTC zone). Test packages use per-process databases and dynamic ports, so
they run in parallel.

The S3 server is SeaweedFS in mini mode. `make starts3` prints the `AWS_S3_*`
variables to export before running `make test`; without them the `pkg/fs`
tests fail with an empty endpoint error.

### Development Environment
```bash
docker-compose up -d # Start Colonies server with dependencies (TimescaleDB, MinIO)
docker-compose up -d # Start Colonies server with dependencies (TimescaleDB, SeaweedFS)
docker-compose down # Stop all services
docker-compose logs -f # View logs
```
Expand Down
Loading