-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (65 loc) · 1.94 KB
/
test.yml
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
name: Tests
on:
workflow_dispatch:
workflow_call:
push:
branches: ["main"]
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
override: true
# - name: Cache Cargo build
# uses: actions/cache@v3
# with:
# path: target
# key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}-cargo-build-
- name: Copy environment variables
run: cp .env-sample .env
- name: Set up Docker Compose
working-directory: docker
run: docker compose --env-file .env-sample up -d
- name: Wait for services to be ready
run: |
until nc -zv 127.0.0.1 6379; do
echo "Waiting for Redis to be ready..."
sleep 1
done
until curl -sS http://localhost:7474; do
echo "Waiting for Neo4j to be ready..."
sleep 1
done
- name: Create example graph
run: docker exec neo4j bash /db-graph/run-queries.sh
# - name: Install dependencies
# run: cargo build --release
- name: Run the service
run: |
cargo run > service.log 2>&1 &
sleep 10 # Give the service a moment to start
- name: Run integration tests
run: cargo test
- name: Show service logs if tests fail
if: failure()
run: cat service.log
- name: Tear down Docker Compose
if: always()
working-directory: docker
run: docker compose down --volumes