-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (79 loc) · 2.75 KB
/
docker-publish.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
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
name: Docker
on:
push:
branches:
- master
tags:
- v*
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Up environment
run: |
docker compose up --build -d
- name: Wait environment
run: |
docker run -t --network apache jwilder/dockerize \
-wait http://apache_apache/ \
-timeout 120s
- name: Logs environment
run: |
docker compose ps
docker compose logs apache
- name: Run tests
run: |
CONTENT=$(curl -s "http://127.0.0.1/");
CONTENT_PHP=$(curl -s "http://127.0.0.1/script.php");
CONTENT_REWRITE=$(curl -s "http://127.0.0.1/rewrite/apache.php");
echo "CHAMADA HTTP NORMAL: ${CONTENT}";
echo "CHAMADA HTTP PHP: ${CONTENT_PHP}";
echo "CHAMADA HTTP REWRITE: ${CONTENT_REWRITE}";
if [ "${CONTENT}" != "html" ]; then
echo "Chamada HTTP NORMAL retornou errado: ${CONTENT}"
exit 1;
fi
if [ "${CONTENT_PHP}" != "php" ]; then
echo "Chamada HTTP TRYFILES retornou errado: ${CONTENT_PHP}"
exit 1;
fi
if [ "${CONTENT_REWRITE}" != "/rewrite/apache.php" ]; then
echo "Chamada HTTP REWRITE retornou errado: ${CONTENT_REWRITE}"
exit 1;
fi
- name: Run tests in https
run: |
CONTENT=$(curl -k -s "https://127.0.0.1/");
CONTENT_PHP=$(curl -k -s "https://127.0.0.1/script.php");
CONTENT_REWRITE=$(curl -k -s "https://127.0.0.1/rewrite/apache.php");
echo "CHAMADA HTTP NORMAL: ${CONTENT}";
echo "CHAMADA HTTP PHP: ${CONTENT_PHP}";
echo "CHAMADA HTTP REWRITE: ${CONTENT_REWRITE}";
if [ "${CONTENT}" != "html" ]; then
echo "Chamada HTTP NORMAL retornou errado: ${CONTENT}"
exit 1;
fi
if [ "${CONTENT_PHP}" != "php" ]; then
echo "Chamada HTTP TRYFILES retornou errado: ${CONTENT_PHP}"
exit 1;
fi
if [ "${CONTENT_REWRITE}" != "/rewrite/apache.php" ]; then
echo "Chamada HTTP REWRITE retornou errado: ${CONTENT_REWRITE}"
exit 1;
fi
push:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: likesistemas/apache
tag_with_ref: true
tag_with_sha: true