-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (146 loc) · 5.82 KB
/
Copy pathintegration-tests.yml
File metadata and controls
168 lines (146 loc) · 5.82 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Integration and Data Consistency Tests
on:
workflow_run:
workflows: ["Build and Publish Docker image to GHCR"]
types: [completed]
workflow_dispatch:
permissions: {}
jobs:
test-sqlite:
name: External Harness (SQLite)
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: read
env:
DATABASE_URL: sqlite:///home/lynx/lynx.db
steps:
- name: Checkout profiled source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
submodules: recursive
- name: Set image reference
id: image
run: echo "reference=ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT"
- name: Build and verify frontend
uses: ./.github/actions/build-frontend
with:
save_cache: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == github.event.repository.default_branch }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore and save trusted debug Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-lynx-rust
shared-key: debug
cache-targets: true
cache-bin: false
save-if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == github.event.repository.default_branch }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Lynx with SQLite
run: |
docker pull "${{ steps.image.outputs.reference }}"
docker run --detach --name lynx \
--publish 8080:8080 --publish 3000:3000 \
--env DATABASE_BACKEND=sqlite \
--env DATABASE_URL \
--env RUST_LOG=info \
--env AUTH_MODE=none \
--env ANALYTICS_ENABLED=true --env ANALYTICS_FLUSH_INTERVAL_SECS=1 \
--env API_HOST=0.0.0.0 --env API_PORT=8080 \
--env REDIRECT_HOST=0.0.0.0 --env REDIRECT_PORT=3000 \
"${{ steps.image.outputs.reference }}"
- name: Run typed external scenarios
run: cargo test --test external_harness -- --ignored --test-threads=1 --nocapture
env:
LYNX_E2E_CONTAINER: lynx
LYNX_E2E_CONCURRENCY: '100'
LYNX_E2E_EXPECT_ANALYTICS: 'true'
RUST_LOG: info
- name: Collect service logs
if: always()
run: docker logs lynx || true
- name: Clean up service
if: always()
run: docker rm --force lynx || true
test-postgres:
name: External Harness (PostgreSQL)
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: read
env:
DATABASE_URL: postgresql://lynx:lynx_password@localhost:5432/lynx
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: lynx
POSTGRES_PASSWORD: lynx_password
POSTGRES_DB: lynx
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout profiled source
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
submodules: recursive
- name: Set image reference
id: image
run: echo "reference=ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT"
- name: Build and verify frontend
uses: ./.github/actions/build-frontend
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore trusted debug Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-lynx-rust
shared-key: debug
cache-targets: true
cache-bin: false
save-if: false
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Lynx with PostgreSQL
run: |
docker pull "${{ steps.image.outputs.reference }}"
docker run --detach --name lynx --network host \
--env DATABASE_BACKEND=postgres --env DATABASE_URL \
--env RUST_LOG=info \
--env AUTH_MODE=none \
--env ANALYTICS_ENABLED=true --env ANALYTICS_FLUSH_INTERVAL_SECS=1 \
--env API_HOST=0.0.0.0 --env API_PORT=8080 \
--env REDIRECT_HOST=0.0.0.0 --env REDIRECT_PORT=3000 \
"${{ steps.image.outputs.reference }}"
- name: Run typed external scenarios
run: cargo test --test external_harness -- --ignored --test-threads=1 --nocapture
env:
LYNX_E2E_CONTAINER: lynx
LYNX_E2E_CONCURRENCY: '100'
LYNX_E2E_EXPECT_ANALYTICS: 'true'
RUST_LOG: info
- name: Collect service logs
if: always()
run: docker logs lynx || true
- name: Clean up service
if: always()
run: docker rm --force lynx || true