-
Notifications
You must be signed in to change notification settings - Fork 262
99 lines (85 loc) · 2.96 KB
/
ci-container-build.yaml
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
name: Container Image Build Test for PRs
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
workflow_dispatch:
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Container Run
run: |
./run-platform.sh -b
sleep 30
docker compose -f docker/docker-compose.yaml ps -a
# Get the names of exited containers
custom_format="{{.Name}}\t{{.Image}}\t{{.Service}}"
EXITED_CONTAINERS=$(docker compose -f docker/docker-compose.yaml ps -a --filter status=exited --format "$custom_format")
line_count=$(echo "$EXITED_CONTAINERS" | wc -l)
if [ "$line_count" -gt 1 ]; then
echo "Exited Containers: $EXITED_CONTAINERS"
SERVICE=$(echo "$EXITED_CONTAINERS" | awk 'NR>0 {print $3}')
echo "Exited Services:"
echo "$SERVICE"
echo "There are exited containers."
# Print logs of exited containers
IFS=$'\n'
for SERVICE in $SERVICE; do
docker compose -f docker/docker-compose.yaml logs "$SERVICE"
done
docker compose -f docker/docker-compose.yaml down -v
exit 1
fi
curl -vvv http://frontend.unstract.localhost
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: latest
install-chromedriver: false
- name: Cache tox environments
uses: actions/cache@v4
with:
path: .tox/
key: ${{ runner.os }}-tox-${{ hashFiles('**/pyproject.toml', '**/tox.ini') }}
restore-keys: |
${{ runner.os }}-tox-
- name: Install tox
run: pip install tox
- name: Run tox
id: tox
run: |
tox -e e2e
- name: Render the report to the PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: e2e-test-report
recreate: true
path: e2e-report.md
- name: Output reports to the job summary when tests fail
shell: bash
run: |
if [ -f "e2e-report.md" ]; then
echo "<details><summary>E2E Test Report</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat "e2e-report.md" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
- name: Stop any running containers
run: docker compose -f docker/docker-compose.yaml down -v