-
Notifications
You must be signed in to change notification settings - Fork 30
144 lines (111 loc) · 4.84 KB
/
pull_requests.yml
File metadata and controls
144 lines (111 loc) · 4.84 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
name: Docker - Debian
on:
pull_request:
branches: [ master ]
jobs:
build-docker-debian:
name: Build Debian Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Docker build
run: docker build -t libki-server -f docker/Dockerfile .
- name: Export image to file
run: docker save libki-server > ${{ github.sha }}.debian.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}.debian.tar
path: ${{ github.sha }}.debian.tar
test-docker-debian:
name: Debian Docker image unit tests
needs: build-docker-debian
runs-on: ubuntu-latest
steps:
- name: Download image artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}.debian.tar
path: /tmp
- name: Import image from file
run: docker load --input /tmp/${{ github.sha }}.debian.tar
- name: Create docker network
run: docker network create libki-net
- name: Start database container
run: docker run --name libki-mariadb --network libki-net -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=libki --rm -d mariadb:10.3.5
- name: Sleep to give database container time to launch
run: sleep 30
- name: Start Libki container
run: docker run --name libki-test-server --network libki-net -e 'LIBKI_INSTANCE=demo' -e 'LIBKI_DB_DSN=dbi:mysql:libki;host=libki-mariadb;port=3306' -e 'LIBKI_DB_USER=root' -e 'LIBKI_DB_PASSWORD=password' -e 'LIBKI_DB_HOST=libki-mariadb' -e 'LIBKI_DB_PORT=3306' -e 'LIBKI_DB_DATABASE=libki' -d libki-server
- name: Sleep to give Libki container time to launch
run: sleep 30
- name: List docker containers
run: docker ps && docker logs libki-test-server
- name: Set up the Libki database
run: docker exec -t libki-test-server /app/installer/update_db.pl
- name: Run unit tests
run: |
docker exec -t libki-test-server prove /app/t/01app.t
docker exec -t libki-test-server prove /app/t/stdout.t
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/02pod.t
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/03podcoverage.t
build-docker-alpine:
name: Build Docker Alpine image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Docker build
run: docker build -t libki-server -f docker/Dockerfile.alpine .
- name: Export image to file
run: docker save libki-server > ${{ github.sha }}.alpine.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}.alpine.tar
path: ${{ github.sha }}.alpine.tar
test-docker-alpine:
name: Alpine Docker image unit tests
needs: build-docker-alpine
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Download image artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}.alpine.tar
path: /tmp
- name: Import image from file
run: docker load --input /tmp/${{ github.sha }}.alpine.tar
- name: Create docker network
run: docker network create libki-net
- name: Start database container
run: docker run --name libki-mariadb --network libki-net -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=libki --rm -d mariadb:10.3.5
- name: Sleep to give database container time to launch
run: sleep 30
- name: Load database schema
run: cat installer/schema.sql | docker exec -i libki-mariadb /usr/bin/mysql -u root --password=password libki
- name: Load database default data
run: cat installer/data.sql | docker exec -i libki-mariadb /usr/bin/mysql -u root --password=password libki
- name: Start Libki container
run: docker run --name libki-test-server --network libki-net -e 'LIBKI_INSTANCE=demo' -e 'LIBKI_DB_DSN=dbi:mysql:libki;host=libki-mariadb;port=3306' -e 'LIBKI_DB_USER=root' -e 'LIBKI_DB_PASSWORD=password' -e 'LIBKI_DB_HOST=libki-mariadb' -e 'LIBKI_DB_PORT=3306' -e 'LIBKI_DB_DATABASE=libki' -e 'LIBKI_TZ=America/New_York' -d libki-server
- name: Sleep to give Libki container time to launch
run: sleep 30
- name: List docker containers
run: docker ps && docker logs libki-test-server
- name: Set up the Libki database
run: docker exec -t libki-test-server /app/installer/update_db.pl
- name: Run unit tests
run: |
docker exec -t libki-test-server prove /app/t/01app.t
docker exec -t libki-test-server prove /app/t/stdout.t
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/02pod.t
docker exec -t -e TEST_POD=1 libki-test-server prove /app/t/03podcoverage.t