-
Notifications
You must be signed in to change notification settings - Fork 19
142 lines (126 loc) · 4.26 KB
/
Copy pathcli-integration.yml
File metadata and controls
142 lines (126 loc) · 4.26 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CLI Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
pull-requests: read
jobs:
cli-integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: opentoggl
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d opentoggl"
--health-interval 5s
--health-timeout 3s
--health-retries 20
redis:
image: redis:8-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 20
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Check changed files
id: changes
uses: dorny/paths-filter@v4
with:
filters: |
cli_integration:
- 'apps/backend/**'
- 'packages/**'
- 'lib/**'
- 'openapi/**'
- 'tests/cli-integration/**'
- 'tests/python-sdk-integration/**'
- '.github/workflows/cli-integration.yml'
- 'go.mod'
- 'go.sum'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.env.example'
- '.air.toml'
- uses: pnpm/action-setup@v6
if: steps.changes.outputs.cli_integration == 'true'
- uses: actions/setup-node@v6
if: steps.changes.outputs.cli_integration == 'true'
with:
node-version: 24
cache: "pnpm"
- name: Install dependencies
if: steps.changes.outputs.cli_integration == 'true'
run: pnpm install
- name: Build backend
if: steps.changes.outputs.cli_integration == 'true'
env:
CGO_ENABLED: 0
run: go build -o /tmp/opentoggl ./apps/backend
- name: Start backend
if: steps.changes.outputs.cli_integration == 'true'
env:
OPENTOGGL_SERVICE_NAME: opentoggl-api
PORT: 8080
DATABASE_URL: postgres://postgres:postgres@localhost:5432/opentoggl?sslmode=disable
REDIS_URL: redis://127.0.0.1:6379/0
OPENTOGGL_FILESTORE_NAMESPACE: opentoggl
OPENTOGGL_JOBS_QUEUE_NAME: default
run: |
/tmp/opentoggl &
for i in {1..30}; do
if curl -sf http://localhost:8080/readyz > /dev/null 2>&1; then
echo "Backend is ready"
break
fi
echo "Waiting for backend... ($i/30)"
sleep 2
done
- name: Install toggl CLI
if: steps.changes.outputs.cli_integration == 'true'
run: |
npm install -g @correctroadh/toggl-cli
toggl --help >/dev/null
- name: Run CLI integration tests
if: steps.changes.outputs.cli_integration == 'true'
env:
OPENTOGGL_CLI_TEST_URL: http://127.0.0.1:8080/api/v9
OPENTOGGL_CLI_TEST_BASE: http://127.0.0.1:8080
run: pnpm run test:cli
- name: Setup Python
if: steps.changes.outputs.cli_integration == 'true'
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install Python SDK test dependencies
if: steps.changes.outputs.cli_integration == 'true'
working-directory: tests/python-sdk-integration/toggl-cli
run: pip install -r requirements.txt -r test-requirements.txt
- name: Run Python SDK integration tests
if: steps.changes.outputs.cli_integration == 'true'
working-directory: tests/python-sdk-integration
env:
OPENTOGGL_CLI_TEST_URL: http://127.0.0.1:8080/api/v9
OPENTOGGL_CLI_TEST_BASE: http://127.0.0.1:8080
run: python -m pytest -x -v
- name: Skip CLI integration tests
if: steps.changes.outputs.cli_integration != 'true'
run: echo "Skipping CLI integration tests because this change does not touch backend, CLI tests, shared runtime, OpenAPI, dependency, or CI files."