name: Docker Tests on: push: branches: [main] paths-ignore: - 'docs/**' - 'README.md' - 'CHANGELOG.md' - '.forgejo/ISSUE_TEMPLATE/**' - '**/*.md' workflow_dispatch: concurrency: group: ${{ gitea.workflow }}-${{ gitea.ref }} cancel-in-progress: true permissions: contents: read security-events: write env: GO_VERSION: '1.25.0' ZIG_VERSION: '0.15.2' jobs: docker-tests: name: Docker Container Tests runs-on: self-hosted timeout-minutes: 45 services: redis: image: redis:7 ports: - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Go run: | REQUIRED_GO="${{ env.GO_VERSION }}" if command -v go &> /dev/null && go version | grep -q "go${REQUIRED_GO}"; then echo "Go ${REQUIRED_GO} already installed" else echo "Installing Go ${REQUIRED_GO}..." curl -sL "https://go.dev/dl/go${REQUIRED_GO}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xzf - export PATH="/usr/local/go/bin:$PATH" echo "/usr/local/go/bin" >> $GITHUB_PATH fi go version - name: Set up Zig run: | ZIG_VERSION="${{ env.ZIG_VERSION }}" if command -v zig &> /dev/null && zig version | grep -q "${ZIG_VERSION}"; then echo "Zig ${ZIG_VERSION} already installed" else echo "Installing Zig ${ZIG_VERSION}..." ZIG_DIR="/usr/local/zig-${ZIG_VERSION}" curl -fsSL --retry 3 "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" -o /tmp/zig.tar.xz sudo mkdir -p "${ZIG_DIR}" sudo tar -C "${ZIG_DIR}" --strip-components=1 -xJf /tmp/zig.tar.xz sudo ln -sf "${ZIG_DIR}/zig" /usr/local/bin/zig echo "${ZIG_DIR}" >> $GITHUB_PATH fi zig version - name: Run unit tests run: go test -v -race ./... -tags=unit -timeout 15m env: LOG_LEVEL: warn - name: Run integration tests run: go test -v -race ./tests/integration/... -timeout 20m env: LOG_LEVEL: warn - name: Run E2E tests run: go test -v ./tests/e2e/... -timeout 20m env: LOG_LEVEL: warn - name: Run chaos tests run: go test -v ./tests/chaos/... -timeout 10m env: LOG_LEVEL: warn - name: Run stress tests run: go test -v ./tests/stress/... -timeout 5m env: LOG_LEVEL: warn - name: Run mock GPU tests - NVIDIA 4x A100 run: go test -v ./tests/e2e/... -run TestCapability -timeout 10m env: FETCH_ML_MOCK_GPU_TYPE: NVIDIA FETCH_ML_MOCK_GPU_COUNT: "4" FETCH_ML_MOCK_VRAM_GB: "80" LOG_LEVEL: warn - name: Run mock GPU tests - Metal 8x run: go test -v ./tests/e2e/... -run TestCapability -timeout 10m env: FETCH_ML_MOCK_GPU_TYPE: Apple FETCH_ML_MOCK_GPU_COUNT: "8" FETCH_ML_MOCK_VRAM_GB: "128" LOG_LEVEL: warn - name: Run mock GPU tests - CPU only run: go test -v ./tests/e2e/... -run TestCapability -timeout 10m env: FETCH_ML_MOCK_GPU_TYPE: "" FETCH_ML_MOCK_GPU_COUNT: "0" FETCH_ML_MOCK_CPU_COUNT: "32" LOG_LEVEL: warn - name: Build Docker image run: | docker build -t fetchml-test:latest -f build/docker/simple.Dockerfile . - name: Run tests in Docker container run: | docker run --rm \ --network host \ -e REDIS_ADDR=localhost:6379 \ fetchml-test:latest \ go test -v ./tests/integration/... -timeout 10m - name: Upload test results if: always() uses: actions/upload-artifact@v4 with: name: test-results-docker path: | *.out *.log retention-days: 7 - name: Generate coverage report run: | go test -coverprofile=coverage.out ./... go tool cover -html=coverage.out -o coverage.html - name: Upload coverage if: always() uses: actions/upload-artifact@v4 with: name: coverage-report-docker path: | coverage.out coverage.html retention-days: 30