-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.05 KB
/
ci.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
name: Dockerized CI with IntegrationTests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Docker Compose
run: |
DOCKER_COMPOSE_VERSION=2.20.2
curl -L "https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose version
shell: bash
- name: Start Docker Services
run: |
docker compose -f compose.yaml up --build -d
shell: bash
- name: Run Migrations
run: |
shell: bash
# Wait until the main REST API is up on localhost:8081
# so integration tests don’t fail immediately.
- name: Wait for Paperless REST container
run: |
echo "Waiting up to 120 seconds for the Paperless REST container to respond on port 8081..."
for i in {1..24}; do
if curl --silent --fail http://localhost:8081/; then
echo "Paperless REST is up!"
exit 0
fi
echo "Still waiting..."
sleep 5
done
echo "Paperless REST service did not become ready in time!"
exit 1
shell: bash
- name: Restore .NET Dependencies
run: dotnet restore
shell: bash
- name: Build .NET Solution
run: dotnet build --no-restore --configuration Debug
shell: bash
- name: Run Tests
run: dotnet test --no-build --configuration Debug --verbosity normal
shell: bash
- name: Cleanup Docker Services
if: always()
run: docker compose -f compose.yaml down --volumes
shell: bash