CI-runner #2724
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Documented in https://wiki.surfnet.nl/display/coininfra/SRAM+CI+Runner | |
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 |