Skip to content

Self-Hosted Runner for Integration Tests #801

Self-Hosted Runner for Integration Tests

Self-Hosted Runner for Integration Tests #801

name: Self-Hosted Runner for Integration Tests
on:
workflow_dispatch:
env:
SH_RUNNER_MANAGE_TOKEN: ${{secrets.SH_RUNNER_MANAGE_TOKEN }}
jobs:
# This job creates a self-hosted runner attached to the
# test organization.
Integration_SH_Runner:
name: Ephemeral Self-Hosted Runner
runs-on: ubuntu-latest
timeout-minutes: 16
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Configure and Run Self-Hosted Runner
run: |
pip install requests
mkdir actions-runner && cd actions-runner
curl -o actions-runner-linux-x64-2.312.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.312.0/actions-runner-linux-x64-2.312.0.tar.gz
tar xzf ./actions-runner-linux-x64-2.312.0.tar.gz
python ../test/runner_helper.py register
nohup ./run.sh &
- name: Sleep
run: python3 -c "import time; time.sleep(840)"
- name: Remove Runner
run: |
cd actions-runner
python ../test/runner_helper.py remove
SH_Runner_Cleanup:
# Removes the self-hosted runner forcibly in the event the cleanup operation
# did not work.
name: Remove Self-Hosted Runner
runs-on: ubuntu-latest
needs: Integration_SH_Runner
if: failure()
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Force Remove SH Runner
run: |
pip install requests
python test/runner_helper.py force_remove