-
Notifications
You must be signed in to change notification settings - Fork 19
119 lines (101 loc) · 3.45 KB
/
cli.test.yaml
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
109
110
111
112
113
114
115
116
117
118
119
name: "cli: test"
on:
push:
branches-ignore:
- "master"
paths:
- "cli/**"
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: miko-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.10.0"
- name: Install yarn dependencies
run: yarn install
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.3"
check-latest: true
cache-dependency-path: |
./api/go.sum
- name: Install golang-migrate
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.0/migrate.linux-amd64.tar.gz | tar xvz
sudo mv ./migrate /usr/bin
- name: Install delegator dependencies
working-directory: ./delegator
run: go mod tidy
- name: Install api dependencies
working-directory: ./api
run: go mod tidy
- name: Create delegator database
run: PGPASSWORD=$POSTGRES_PASSWORD psql -h localhost -U postgres -c "CREATE DATABASE delegator"
env:
POSTGRES_PASSWORD: postgres
- name: Delegator db migrate
working-directory: ./delegator
run: migrate -database "postgresql://postgres:postgres@localhost:5432/delegator?search_path=public&sslmode=disable" -verbose -path ./migrations up
- name: Api db migrate
working-directory: ./api
run: migrate -database "postgresql://postgres:postgres@localhost:5432/miko-test?search_path=public&sslmode=disable" -verbose -path ./migrations up
- name: Run delegator
working-directory: ./delegator
run: go run main.go &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/delegator?search_path=public"
PROVIDER_URL: "https://public-en-kairos.node.kaia.io"
APP_PORT: "3002"
- name: Run api
working-directory: ./api
run: go run main.go &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/miko-test?search_path=public"
ENCRYPT_PASSWORD: "abc123"
APP_PORT: "3000"
REDIS_HOST: "localhost"
REDIS_PORT: "6379"
- name: Check Delegator Service Health
run: |
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:3002/api/v1); do
echo "Waiting for delegator service to be ready..."
sleep 5
done
- name: Check API Service Health
run: |
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:3000/api/v1); do
echo "Waiting for api service to be ready..."
sleep 5
done
- name: Run tests
run: yarn cli build && yarn cli test
env:
ORAKL_NETWORK_API_URL: "http://127.0.0.1:3000/api/v1"
ORAKL_NETWORK_DELEGATOR_URL: "http://127.0.0.1:3002/api/v1"