-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (80 loc) · 2.72 KB
/
build-test.yaml
File metadata and controls
81 lines (80 loc) · 2.72 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
name: Build and run tests
on:
push:
branches:
- main
pull_request: {} # any target
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
podman-checkout-test:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ctrmgr: ['docker', 'podman']
name: Checkout Test (${{matrix.ctrmgr}})
env:
AUTHNZ_EMU: "demo"
COMPOSE_PROFILES: "full"
ANMS_COMPOSE_OPTS: "-f docker-compose.yml"
TESTENV_COMPOSE_OPTS: "-f testenv-compose.yml"
DOCKER_CMD: ${{matrix.ctrmgr}}
AUTHNZ_PORT: 8084
AUTHNZ_HTTPS_PORT: 8443
steps:
- name: Start Container Service
if: ${{matrix.ctrmgr == 'podman'}}
run: |
systemctl --user start podman.socket
systemctl --user enable podman.socket
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
- name: Versions
run: |
${DOCKER_CMD} -v
${DOCKER_CMD} compose -v
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: recursive
- name: Tag name env
run: |
DOCKER_IMAGE_TAG=${{ github.sha }}
echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}" >> $GITHUB_ENV
- name: Build ANMS
run: ${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build
- name: Build Agents
run: ${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} build
- name: Build Volume
run: |
./create_volume.sh ./puppet/modules/apl_test/files/anms/tls
sudo mkdir /run/anms
- name: Pull Images
run: ${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} pull --ignore-buildable
- name: Start
run: |
# testenv started before
${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} up -d --force-recreate
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} up -d --force-recreate --wait --wait-timeout 600
- name: Status
if: always()
run: |
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps
for BADSTATUS in stopped restarting; do
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps --services --filter status=${BADSTATUS} | tee -a /tmp/notgood
done
# Show hints at what may be wrong
for SERVNAME in $(cat /tmp/notgood); do
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} logs --tail 50 ${SERVNAME}
done
# Fail if any names are in the file
! grep '[^[:space:]]' /tmp/notgood
- name: Test
run: ./checkout-test/run.sh
- name: Stop
if: always()
run: |
# testenv stopped after
for OPTS_NAME in ANMS_COMPOSE_OPTS TESTENV_COMPOSE_OPTS; do
${DOCKER_CMD} compose ${!OPTS_NAME} down --remove-orphans
done