-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (73 loc) · 2.44 KB
/
ci-runner.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
---
name: CI-runner
on:
push:
pull_request:
# Triggers the workflow manually
workflow_dispatch:
inputs:
foobar:
description: 'my Foobar'
required: true
default: 'myBar'
jobs:
test:
if: "github.actor!='dependabot[bot]'"
runs-on: "self-hosted"
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout $GITHUB_WORKSPACE
uses: actions/checkout@v4
# Decrypt secret
- name: Copy secret
shell: bash
env:
secret_vm: ${{ secrets.SECRET_VM }}
run: "echo $secret_vm > secret_vm"
- name: Hello World
run: |
touch HelloWorld
echo "Hello world ${{ github.event.inputs.foobar }}" >> HelloWorld
- name: Stop running dockers
run: |
./docker/docker-compose.yml.py --ci > ./docker/docker-compose-ci.yml
docker-compose -f docker/docker-compose-ci.yml stop
docker-compose -f docker/docker-compose-ci.yml rm -f sbs
- name: Start CI env
run: |
./start-vm --ci
- name: Output SBS version
run: |
curl -k https://sbs.ci-runner.sram.surf.nl/info
- name: Bootstrap virtualenv in ci-runner
run: |
python3 -m virtualenv --python=python3 ci-runner
ci-runner/bin/pip install -r ci-runner/requirements.txt
- name: Seed SBS
run: |
docker exec docker-sbs-1 /tmp/ci-runner/seed.py
- name: Run tests
run: |
ci-runner/bin/behave ci-runner/features/
- name: Show error output
run: >
ansible -v -i ./environments/ci/inventory --become "all" -m command -a "/bin/sh -c '
echo ====journal===;
journalctl -n1000;
if [ -e /var/log/apache2/error.log ]; then
echo ===apache errorlog===;
cat /var/log/apache2/error.log;
fi;
if [ -e /opt/sbs ]; then
echo ===sbs log===;
cat /opt/sbs/log/sbs_debug.log
fi;
echo ===apt log===; cat /var/log/apt/term.log;
echo ===netstat===; netstat -lnp;
'"
if: failure()
- name: Stop running dockers
run: |
./docker/docker-compose.yml.py --ci > ./docker/docker-compose-ci.yml
docker-compose -f docker/docker-compose-ci.yml stop
docker-compose -f docker/docker-compose-ci.yml rm -f sbs