-
Notifications
You must be signed in to change notification settings - Fork 49
63 lines (59 loc) · 1.89 KB
/
main.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
name: main
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build container image
run: |
docker buildx create --use
VERSION=`cat VERSION`
echo "Docker tag is: ${VERSION}"
docker buildx build --platform linux/amd64 --tag adferrand/backuppc --load .
mkdir -p dist
docker save adferrand/backuppc | gzip -c -1 > dist/docker-backuppc.tar.gz
- name: Upload container image as artifact
uses: actions/upload-artifact@v3
with:
name: dist-image
path: dist
unit-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download container image artifact
uses: actions/download-artifact@v3
with:
name: dist-image
- name: Run unit tests
run: |
docker load < docker-backuppc.tar.gz
mkdir -p ./bin
curl -fsSL https://goss.rocks/install | GOSS_DST=./bin sh
GOSS_PATH=./bin/goss GOSS_SLEEP=5 GOSS_FILES_PATH=./tests ./bin/dgoss run adferrand/backuppc
integration-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download container image artifact
uses: actions/download-artifact@v3
with:
name: dist-image
- name: Run integration tests
run: |
docker load < docker-backuppc.tar.gz
docker run --name backuppc-integration --detach -p 8080:8080 adferrand/backuppc
sleep 5
output="$(curl http://backuppc:password@localhost:8080/BackupPC_Admin)"
echo "Expect the backupp configuration page without errors"
grep "The servers PID is" <(echo $output)
docker rm -f backuppc-integration