Skip to content
Closed
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
23 changes: 20 additions & 3 deletions .temporalci.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
steps:
# Stage 1: Build (runs first)
- name: build
image: golang:1.23
command: go build ./...
command: go build -v ./...
timeout: 5m
- name: test

# Stage 2: These run in parallel after build
- name: unit-test
image: golang:1.23
command: go test -v ./...
command: go test -v -count=1 ./...
timeout: 5m
depends_on: [build]

- name: vet
image: golang:1.23
command: go vet ./...
timeout: 2m
depends_on: [build]

- name: format-check
image: golang:1.23
command: test -z "$(gofmt -l .)"
timeout: 1m
depends_on: [build]

# Stage 3: Runs after unit tests pass
- name: race-test
image: golang:1.23
command: go test -race -count=1 ./...
timeout: 5m
depends_on: [unit-test]
38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
# TemporalCI-test

A simple Go project used to test [TemporalCI](https://github.com/AndreKurait/TemporalCI) CI pipeline integration.
A test repository for [TemporalCI](https://github.com/AndreKurait/TemporalCI) — a Kubernetes-native CI system built on Temporal.

## What this tests
## What Happens When You Push

- PR-triggered CI via TemporalCI's reusable workflow
- Go build, test, and vet
- JUnit XML test result generation
- Test summary reporting
Every push and PR triggers a **TemporalCI pipeline** that:

1. **Clones** this repo into an isolated K8s pod
2. **Runs steps as a DAG** — independent steps execute in parallel
3. **Reports results** directly on the PR with timing, logs, and a link to the Temporal Web UI

### Pipeline (``.temporalci.yaml``)

```
build ──┬── unit-test ── race-test
├── vet
└── format-check
```

- `build` runs first
- `unit-test`, `vet`, and `format-check` run **in parallel** after build
- `race-test` runs after unit tests pass

### Helm Chart Testing

This repo also includes a Helm chart at `deploy/helm/`. TemporalCI can lease an **ephemeral EKS cluster** from a warm pool, install the chart, run `helm test`, and report results — all orchestrated as a durable Temporal workflow.

## Functions

| Function | Description |
|----------|-------------|
| `Greet(name)` | Returns a greeting |
| `Reverse(s)` | Reverses a string |
| `IsPalindrome(s)` | Checks if a string is a palindrome |
| `Anagram(a, b)` | Checks if two strings are anagrams |
22 changes: 22 additions & 0 deletions anagram.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import "strings"

// Anagram checks if two strings are anagrams of each other.
func Anagram(a, b string) bool {
a, b = strings.ToLower(a), strings.ToLower(b)
if len(a) != len(b) {
return false
}
counts := make(map[rune]int)
for _, c := range a {
counts[c]++
}
for _, c := range b {
counts[c]--
if counts[c] < 0 {
return false
}
}
return true
}
22 changes: 22 additions & 0 deletions anagram_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import "testing"

func TestAnagram(t *testing.T) {
tests := []struct {
a, b string
want bool
}{
{"listen", "silent", true},
{"hello", "world", false},
{"Astronomer", "Moon starer", false},
{"abc", "cba", true},
{"", "", true},
{"a", "ab", false},
}
for _, tt := range tests {
if got := Anagram(tt.a, tt.b); got != tt.want {
t.Errorf("Anagram(%q, %q) = %v, want %v", tt.a, tt.b, got, tt.want)
}
}
}