-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 1.99 KB
/
tests.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
name: Github Actions CI
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 5 * * 0"
env:
IMAGE_NAME: ttrss-docker
jobs:
test_and_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build image
run: docker build rss --file rss/Dockerfile --tag image
- name: Tag image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
VERSION=$(date "+%Y.%m.%d")
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag $IMAGE_ID:$VERSION $IMAGE_ID:latest
- name: Run tests
run: |
set -ex
docker compose -p ttrssdocker up -d
docker ps
docker container inspect -f '{{.State.Running}}' ttrssdocker-phpfpm-1
sleep 40s && docker compose -p ttrssdocker logs && ./setup.sh
docker compose -p ttrssdocker restart
sleep 30s
curl -sI http://localhost
curl -sI http://localhost | grep "200 OK"
curl -sI http://localhost/config.php | grep 403
curl -sI http://localhost/.htaccess | grep 403
curl -sI http://localhost/cache | grep 403
curl -sI http://localhost/cache/ | grep 403
curl -sI --tlsv1.3 http://localhost | grep 200
if [ "$(curl -si http://localhost | grep -c 'Startup failed')" -ge 2 ]; then
docker compose -p ttrssdocker logs update_daemon
false
fi
./backup.sh && ls -la ~/.backup/ttrss*gz
docker compose -p ttrssdocker down
docker volume rm ttrssdocker_ttrss ttrssdocker_pgdata ttrssdocker_caddy2
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
VERSION=$(date "+%Y.%m.%d")
docker push $IMAGE_ID:latest