2022-07-01 07:32:16 +00:00
|
|
|
name: start testground
|
|
|
|
description: setup a local testground instance
|
2022-09-07 06:45:54 +00:00
|
|
|
inputs:
|
|
|
|
testground_endpoint:
|
|
|
|
required: false
|
|
|
|
default: ''
|
|
|
|
testground_repository:
|
|
|
|
required: false
|
|
|
|
default: 'testground/testground'
|
|
|
|
testground_ref:
|
|
|
|
required: false
|
|
|
|
default: 'edge'
|
2022-07-01 07:32:16 +00:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
2022-09-07 06:45:54 +00:00
|
|
|
# Default setup when we use the testground_ref == edge.
|
|
|
|
- name: Load testground
|
|
|
|
if: ${{ inputs.testground_ref == 'edge' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-09-23 09:42:26 +00:00
|
|
|
for i in 1 2 3; do
|
|
|
|
echo "=== Attempt $i ==="
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/testground/testground/master/install.sh)" && \
|
|
|
|
exit 0
|
|
|
|
sleep 10
|
|
|
|
done
|
|
|
|
exit 1
|
2022-09-07 06:45:54 +00:00
|
|
|
# Custom setup (slower) when we use a different testground_ref
|
2022-07-01 07:32:16 +00:00
|
|
|
- name: Checkout testground
|
2022-09-07 06:45:54 +00:00
|
|
|
if: ${{ inputs.testground_ref != 'edge' }}
|
2022-07-01 07:32:16 +00:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: testground
|
2022-09-07 06:45:54 +00:00
|
|
|
repository: ${{ inputs.testground_repository }}
|
|
|
|
ref: ${{ inputs.testground_ref }}
|
2022-07-01 07:32:16 +00:00
|
|
|
|
|
|
|
- name: Setup Go
|
2022-09-07 06:45:54 +00:00
|
|
|
if: ${{ inputs.testground_ref != 'edge' }}
|
|
|
|
uses: actions/setup-go@v3
|
2022-07-01 07:32:16 +00:00
|
|
|
with:
|
2022-09-07 06:45:54 +00:00
|
|
|
cache: true
|
|
|
|
go-version-file: 'testground/go.mod'
|
|
|
|
cache-dependency-path: testground/go.sum
|
2022-07-01 07:32:16 +00:00
|
|
|
|
|
|
|
- name: Install testground
|
2022-09-07 06:45:54 +00:00
|
|
|
if: ${{ inputs.testground_ref != 'edge' }}
|
|
|
|
run: make install || make install || make install # 3 retries in case of network drops.
|
2022-07-01 07:32:16 +00:00
|
|
|
working-directory: testground
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Run the daemon or configure the client
|
|
|
|
shell: bash
|
2022-09-07 06:45:54 +00:00
|
|
|
env:
|
|
|
|
TESTGROUND_ENDPOINT: ${{ inputs.testground_endpoint }}
|
2022-07-01 07:32:16 +00:00
|
|
|
run: |
|
|
|
|
if [[ ! -z "${TESTGROUND_ENDPOINT}" ]]; then
|
|
|
|
mkdir -p ~/testground/;
|
|
|
|
cat <<EOF >> ~/testground/.env.toml
|
|
|
|
|
|
|
|
[client]
|
|
|
|
endpoint = "${TESTGROUND_ENDPOINT}"
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
mkdir -p ~/testground/;
|
|
|
|
cat <<EOF >> ~/testground/.env.toml
|
|
|
|
|
|
|
|
[daemon.scheduler]
|
2022-08-22 10:25:07 +00:00
|
|
|
task_timeout_min = 60
|
2022-07-01 07:32:16 +00:00
|
|
|
EOF
|
|
|
|
testground daemon > testground.out 2> testground.err &
|
2022-08-29 14:34:15 +00:00
|
|
|
fi;
|
|
|
|
|
|
|
|
- name: Check testground daemon health
|
|
|
|
run:
|
|
|
|
echo "Waiting for Testground to launch on 8042...";
|
|
|
|
while ! nc -z localhost 8042; do
|
|
|
|
sleep 1;
|
|
|
|
done;
|
|
|
|
echo "Testground launched";
|
|
|
|
testground healthcheck --runner local:docker --fix;
|
|
|
|
shell: bash
|