-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (91 loc) · 2.96 KB
/
ci.yml
File metadata and controls
108 lines (91 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
jobs:
# 1. Standard Unit Tests & Linting
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install dependencies
run: go mod download
- name: Verify Code Formatting
run: if [ -n "$(gofmt -l .)" ]; then echo "Go code is not formatted"; exit 1; fi
- name: Run Unit Tests
# We run tests with race detection to catch concurrency bugs in the new Pebble implementation
run: go test -race -v ./...
# 2. Build Verification (Cross-Platform)
build:
name: Build Binary
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
- os: linux
arch: arm64
- os: darwin # Verify macOS build (fsnotify fallback)
arch: arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
mkdir -p bin
go build -o bin/diffkeeper-${{ matrix.os }}-${{ matrix.arch }} .
# 3. The "Dogfood" Test (Functional Verification)
# This proves the "Time Machine" feature actually works on Linux (with eBPF/Pebble)
functional-test:
name: Functional Test (The Time Machine)
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build DiffKeeper
run: go build -o diffkeeper .
- name: Create Flaky Script
# This simulates the user scenario: A script that changes a file over time
run: |
cat <<'EOF' > flaky.sh
#!/bin/bash
echo "STATE_1: START" > status.txt
sleep 1
echo "STATE_2: MIDDLE" > status.txt
sleep 1
echo "STATE_3: END" > status.txt
EOF
chmod +x flaky.sh
- name: Record Session
# We run as sudo to allow eBPF to attach to the kernel
run: |
sudo ./diffkeeper record --state-dir=/tmp/trace -- ./flaky.sh
- name: Verify Export (Time Travel)
run: |
# 1. Restore state at ~0.5s (Should be STATE_1)
sudo ./diffkeeper export --state-dir=/tmp/trace --out=/tmp/restore_1 --time="500ms"
# 2. Restore state at ~1.5s (Should be STATE_2)
sudo ./diffkeeper export --state-dir=/tmp/trace --out=/tmp/restore_2 --time="1500ms"
# 3. Assertions
echo "Checking State 1..."
grep "STATE_1: START" /tmp/restore_1/status.txt
echo "Checking State 2..."
grep "STATE_2: MIDDLE" /tmp/restore_2/status.txt
echo "✅ Time Travel Successful!"