-
-
Notifications
You must be signed in to change notification settings - Fork 113
137 lines (135 loc) · 4.51 KB
/
container-test.yml
File metadata and controls
137 lines (135 loc) · 4.51 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
name: Docker container test
on:
workflow_call:
inputs:
variant:
required: true
type: string
test:
required: true
type: string
weblate_sha:
required: false
type: string
weblate_date:
required: false
type: string
port:
required: false
type: number
protocol:
required: false
type: string
jobs:
container-test:
runs-on: ubuntu-24.04
name: Test container ${{ inputs.test }}, ${{ inputs.variant }}
env:
MATRIX_ARCHITECTURE: linux/amd64
COMPOSE_PROJECT_NAME: wl
PYTHONUNBUFFERED: 1
TEST_CONTAINER: weblate/weblate:test
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Docker cache amd64
path: /tmp/.buildx-cache/linux/amd64
- name: Adjust bleeding edge image
if: inputs.variant == 'bleeding'
run: .github/bin/bleeding "$WEBLATE_SHA" "$WEBLATE_DATE"
env:
WEBLATE_SHA: ${{ inputs.weblate_sha }}
WEBLATE_DATE: ${{ inputs.weblate_date }}
- name: Build the Docker image
run: .github/bin/docker-build load
- name: List Docker images
run: docker image ls --all
- name: Test content
run: ./docker-compose/test-content
- name: Generate configuration
working-directory: docker-compose
run: ./test-generate "$WEBLATE_PORT" "$WEBLATE_PROTOCOL" "$WEBLATE_TEST"
env:
WEBLATE_PORT: ${{ inputs.port || 8080 }}
WEBLATE_PROTOCOL: ${{ inputs.protocol || 'http' }}
WEBLATE_TEST: ${{ inputs.test }}
- name: Generate SSL certificate
if: inputs.protocol == 'https'
working-directory: docker-compose
run: |
docker compose up --no-start
VOLUMEPATH="$(docker volume inspect -f '{{.Mountpoint}}' wl_weblate-data)"
sudo mkdir -p "$VOLUMEPATH/ssl"
sudo openssl req -x509 -nodes -days 365 -subj "/CN=localhost" -newkey rsa:2048 -keyout "$VOLUMEPATH/ssl/privkey.pem" -out "$VOLUMEPATH/ssl/fullchain.pem"
sudo chown -R 1000:1000 "$VOLUMEPATH/ssl"
- name: Startup container
working-directory: docker-compose
run: ./test-boot
- name: Show versions
working-directory: docker-compose
run: docker compose run weblate list_versions
- name: List Python packages
working-directory: docker-compose
run: ./test-pip
- name: Inspect container
working-directory: docker-compose
run: ./test-inspect
- name: Check service is running
working-directory: docker-compose
run: ./test-online
- name: Check service health status
working-directory: docker-compose
run: ./test-health
- name: Run Django Checks
working-directory: docker-compose
run: ./test-checks
- name: Verify supervisor
working-directory: docker-compose
run: ./test-supervisor
- name: Test admin creation
working-directory: docker-compose
run: ./test-admin
- name: Verify SAML certificate
working-directory: docker-compose
run: ./test-saml "$WEBLATE_TEST"
env:
WEBLATE_TEST: ${{ inputs.test }}
- name: Test commands
working-directory: docker-compose
run: ./test-commands
- name: Display logs
if: always()
working-directory: docker-compose
run: ./test-logs
- name: Stop Weblate service
working-directory: docker-compose
run: docker compose stop weblate
- name: Start Weblate service
working-directory: docker-compose
run: docker compose start weblate
- name: Check service is running
working-directory: docker-compose
run: ./test-online
- name: Repeated requests
run: |
. docker-compose/.test.env
set +e
for i in $( seq 40000 ) ; do
if ! curl --silent --show-error --fail-with-body --insecure --output /dev/null --max-time 1 "${URL}healthz/" ; then
echo "Failed after $i requests!"
exit 1
fi
done
- name: Shutdown service
working-directory: docker-compose
run: ./test-stop
permissions:
contents: read