-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (50 loc) · 1.54 KB
/
test.yml
File metadata and controls
62 lines (50 loc) · 1.54 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
name: CI/CD
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
test:
name: 🏗️ Build & Test
runs-on: ubuntu-latest
# Define Alice's env requirements once for the whole job
env:
ALICE_SAFARICOM.CERT_PATH: ./public.cer
ALICE_SERVER.PORT: 4000
ALICE_DATABASE.DSN: postgres://localhost:5432/alice_test?sslmode=disable
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v4
- name: 🐹 Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: 📦 Install Dependencies
run: make deps
- name: 🎨 Format Check
run: |
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
echo "❌ The following files are not formatted. Run 'make fmt' locally:"
gofmt -l .
exit 1
fi
- name: 🔍 Static Analysis (Vet)
run: make vet
- name: 🔐 Setup Safaricom Certificate
env:
CERT_B64: ${{ secrets.SAFARICOM_CERT_BASE64 }}
run: |
echo "-----BEGIN PUBLIC KEY-----" > public.cer
echo "$CERT_B64" >> public.cer
echo "-----END PUBLIC KEY-----" >> public.cer
- name: 🧪 Run Unit Tests
run: make test
- name: 🏎️ Run Race Detector
run: make test-race
- name: 🏗️ Verify Binary Build
run: |
# We create a dummy .env so the 'check-env' target doesn't fail the build
touch .env
make build