-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
136 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: TestGround Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tests_files_path: | ||
description: "Path to Tests" | ||
required: true | ||
type: string | ||
default: "compositions/cluster-k8s/sanity/002-da-sync-8.toml" | ||
testground_url: | ||
required: true | ||
type: string | ||
description: "TestGround LoadBalancer URL" | ||
testground_region: | ||
required: true | ||
type: string | ||
description: "TestGround Cluster Region" | ||
default: "eu-west-1" | ||
celestia_node_commit_sha: | ||
required: false | ||
type: string | ||
description: "You can specify any commit that you want to use in the celestia-node repository" | ||
celestia_app_commit_sha: | ||
required: false | ||
type: string | ||
description: "You can specify any commit that you want to use in the celestia-app repository" | ||
|
||
env: | ||
REPO_TG: https://github.com/testground/testground.git | ||
REPO_TEST_TG: https://github.com/celestiaorg/test-infra.git | ||
ORG: celestiaorg | ||
CELESTIA_NODE_REPO: celestia-node | ||
CELESTIA_APP_REPO: celestia-app | ||
BRANCH: main | ||
TG_USER: ga-bot | ||
TESTGROUND_URL: ${{ inputs.testground_url }} | ||
TESTGROUND_REGION: ${{ inputs.testground_region }} | ||
TEST_FILES_PATH: ${{ inputs.tests_files_path }} | ||
|
||
jobs: | ||
testground: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Clone the repo | ||
run: | | ||
git clone ${{ env.REPO_TG }} | ||
git clone ${{ env.REPO_TEST_TG }} | ||
- name: Build TestGround | ||
run: | | ||
export GOBIN=$(go env GOPATH)/bin | ||
mkdir -p $GOBIN | ||
cd testground | ||
make goinstall | ||
- name: Generate Config TestGround | ||
run: | | ||
mkdir -p ~/.config/testground/ | ||
cat <<EOF > ~/.config/testground/.env.toml | ||
[aws] | ||
region="${{ env.TESTGROUND_REGION }}" | ||
[client] | ||
endpoint = "${{ env.TESTGROUND_URL }}" | ||
user="${{ env.TG_USER }}" | ||
EOF | ||
cat ~/.config/testground/.env.toml | ||
# In the next step, we can verify if we need to use an specific commit | ||
# or we can use the one in the file. | ||
- name: Update go.mod with the given inputs | ||
run: | | ||
NODE_COMMIT_SHA=$(echo '${{ inputs.celestia_node_commit_sha }}'| tr -d '"') | ||
if [[ -z "$NODE_COMMIT_SHA" ]];then | ||
echo "[INFO] There's no commit secified, so use the current version" | ||
else | ||
echo "[INFO] Let's use an specific commit SHA for celestia-node" | ||
cd test-infra | ||
# Get the latest commit SHA in the celestia-node repo | ||
CELESTIA_NODE=$(curl -Ls https://api.github.com/repos/${ORG}/${CELESTIA_NODE_REPO}/commits/${BRANCH} | jq -c '.sha'| tr -d '"'| cut -c1-7) | ||
echo $CELESTIA_NODE | ||
# Replace the value in the go.mod file | ||
sed -i "s|github.com/${ORG}/${CELESTIA_NODE_REPO}.*|github.com/${ORG}${CELESTIA_NODE_REPO} ${CELESTIA_NODE}|g" go.mod | ||
cd .. | ||
fi | ||
APP_COMMIT_SHA=$(echo '${{ inputs.celestia_app_commit_sha }}'| tr -d '"') | ||
if [[ -z "$APP_COMMIT_SHA" ]];then | ||
echo "[INFO] There's no commit secified, so use the current version" | ||
else | ||
echo "[INFO] Let's use an specific commit SHA for celestia-app" | ||
cd test-infra | ||
# Get the latest commit SHA in the celestia-node repo | ||
CELESTIA_APP=$(curl -Ls https://api.github.com/repos/${ORG}/${CELESTIA_APP_REPO}/commits/${BRANCH} | jq -c '.sha'| tr -d '"'| cut -c1-7) | ||
echo $CELESTIA_APP | ||
# Replace the value in the go.mod file | ||
sed -i "s|github.com/${ORG}/${CELESTIA_APP_REPO}.*|github.com/${ORG}${CELESTIA_APP_REPO} ${CELESTIA_APP}|g" go.mod | ||
cd .. | ||
fi | ||
- name: Plan the execution | ||
run: | | ||
export GOBIN=$(go env GOPATH)/bin | ||
cd test-infra | ||
$GOBIN/testground plan import --from . --name celestia | ||
- name: Start the TestGround Daemon | ||
run: | | ||
export GOBIN=$(go env GOPATH)/bin | ||
cd test-infra | ||
$GOBIN/testground plan import --from . --name celestia | ||
$GOBIN/testground daemon & | ||
# Check if TestGround Daemon is listening... | ||
until nc -z 127.0.0.1 8042;do | ||
sleep 1 | ||
echo "[INFO] Waiting for the TestGround Daemon to be up & running..." | ||
done | ||
echo "[INFO] TestGround Daemon is ready to start receiving requests!" | ||
- name: Execute the test | ||
run: | | ||
export GOBIN=$(go env GOPATH)/bin | ||
cd test-infra | ||
echo "-----------------------------------------" | ||
$GOBIN/testground run composition -f ${{ env.TEST_FILES_PATH }} | tee tg_run.log | ||
echo "-----------------------------------------" | ||
cat tg_run.log | ||
echo "-----------------------------------------" | ||
TGID=$(awk '/run is queued with ID/ {print $10}' <tg_run.log) | ||
# Check that the task was queued | ||
if [ -z "$TGID" ];then | ||
echo "[ERROR] TestGround test not queued... something went wrong..." | ||
exit 1 | ||
fi | ||
echo "TestGround ID is: [$TGID]" |