-
Notifications
You must be signed in to change notification settings - Fork 50
60 lines (48 loc) · 1.64 KB
/
test-build-server.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
name: Test Server on Pull Request
on:
pull_request:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set permissions on the uploads directory
run: |
sudo chown 1000:1000 ${{ github.workspace }}/Server/data/directus/uploads
- name: Build and Run Docker Compose
run: docker compose -f ${{ github.workspace }}/Server/docker-compose.yml up -d
- name: Install Newman
run: |
npm install -g newman
sleep 10
- name: Integration test
run: |
RETRY_COUNT=0
MAX_RETRIES=5
RETRY_DELAY=10
until [ $RETRY_COUNT -ge $MAX_RETRIES ]
do
newman run ${{ github.workspace }}/.github/workflows/tests/CI/collection.json -e ${{ github.workspace }}/.github/workflows/tests/CI/environment.json --reporters cli && break
RETRY_COUNT=$((RETRY_COUNT+1))
echo "Retry $RETRY_COUNT/$MAX_RETRIES in $RETRY_DELAY seconds..."
sleep $RETRY_DELAY
done
shell: bash
- name: Get logs for all containers
if: failure()
run: |
docker ps -a
docker container ls -aq | xargs -I {} docker logs {}
- name: Clean up
run: docker compose -f ${{ github.workspace }}/Server/docker-compose.yml down