forked from redhat-developer/rhdh-local
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.61 KB
/
Copy pathtest.yml
File metadata and controls
91 lines (77 loc) · 2.61 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
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint
# Based on https://github.com/zavoloklom/docker-compose-linter/tree/main?tab=readme-ov-file
run: |
npx --yes dclint .
test:
strategy:
fail-fast: false
matrix:
tool:
- docker
- podman
composeConfig:
- name: "default"
cliArgs: ""
- name: "debug"
cliArgs: "-f compose.yaml -f compose-debug.yaml"
- name: "corporate-proxy"
cliArgs: "-f compose.yaml -f compose-with-corporate-proxy.yaml"
name: "${{ matrix.tool }} compose - ${{ matrix.composeConfig.name }}"
runs-on: ubuntu-latest
env:
# The default corporate proxy image is located on registry.redhat.io, which requires authentication.
CORPORATE_PROXY_IMAGE: docker.io/ubuntu/squid:latest
# To be able to call the "podman compose" wrapper using the "podman-compose" binary
PODMAN_COMPOSE_PROVIDER: "podman-compose"
steps:
- uses: actions/checkout@v4
- name: prepare .env
run: cp env.sample .env
- name: Install tool
if: ${{ matrix.tool == 'podman' }}
env:
PODMAN_COMPOSE_VERSION: "v1.3.0"
run: |
pip3 install podman-compose=="${PODMAN_COMPOSE_VERSION}"
- name: Start app
run: |
${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} up -d
${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} ps
- name: Wait for HTTP 200 response from homepage
run: |
max=30
i=0
echo "Waiting for localhost to respond with status code 200..."
until curl --head --fail http://localhost:7007; do
i=$((i+1))
if [ "$i" -ge "$max" ]; then
echo "Max retries reached. Exiting. Take a look at the logs in the step below."
exit 1
fi
echo "($i/$max)Waiting for http://localhost:7007 to return HTTP 200..."
sleep 5
done
echo "RHDH is ready!"
curl -i --insecure http://localhost:7007
- name: Compose logs
if: always()
run: ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} logs
- name: Tear down
if: always()
run: |
${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} ps || true
${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} down --volumes || true