Run Performance test #30
Workflow file for this run
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
name: Run Performance test | |
on: | |
workflow_dispatch: # manually triggered | |
inputs: | |
test_name: | |
type: string | |
description: Folder name under "performance" that contains yaml | |
required: true | |
js_ceramic_image: | |
type: string | |
description: Image for js-ceramic | |
required: true | |
default: ceramicnetwork/js-ceramic:latest | |
rust_ceramic_image: | |
type: string | |
description: Image for rust-ceramic | |
required: true | |
default: public.ecr.aws/r5b3e0r5/3box/ceramic-one:latest | |
scenario_image: | |
type: string | |
description: Image for scenario | |
required: true | |
default: public.ecr.aws/r5b3e0r5/3box/keramik-runner:latest | |
env: | |
CARGO_TERM_COLOR: always | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
jobs: | |
run-performance-test: | |
name: Run Performance Test ${{ github.run_id }} | |
runs-on: ubuntu-latest | |
environment: cas-scaling-2024 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install yq | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common | |
sudo add-apt-repository -y ppa:rmescandon/yq | |
sudo apt-get update | |
sudo apt-get install -y yq | |
- name: Template network | |
run: | | |
set -exo pipefail | |
export RUST_CERAMIC_IMAGE=${{ inputs.rust_ceramic_image }} | |
export SCENARIO_IMAGE=${{ inputs.scenario_image }} | |
export JS_CERAMIC_IMAGE=${{ inputs.js_ceramic_image }} | |
export TEST_NAME=${{ inputs.test_name }} | |
ls -l performance/$TEST_NAME | |
export THIS_TEST=${{ inputs.test_name }}-${{ github.run_id }} | |
mkdir -p performance/$THIS_TEST | |
# set the network name yaml key to the test names | |
yq e '.metadata.name = env(THIS_TEST)' performance/$TEST_NAME/network.yaml \ | |
> performance/$THIS_TEST/network.yaml | |
cat performance/$THIS_TEST/network.yaml | |
echo "THIS_TEST=$THIS_TEST" >> $GITHUB_ENV | |
echo "THIS_TEST_NAMESPACE=keramik-${THIS_TEST}" >> $GITHUB_ENV | |
echo "TEST_NAME=${TEST_NAME}" >> $GITHUB_ENV | |
- name: Setup GKE auth | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.GKE_SA_KEY }} | |
- name: Get GKE credentials | |
uses: 'google-github-actions/get-gke-credentials@v1' | |
with: | |
cluster_name: ${{ vars.GKE_CLUSTER }} | |
location: ${{ vars.GKE_ZONE }} | |
- name: Deploy network | |
run: | | |
kubectl apply -f performance/$THIS_TEST/network.yaml | |
- name: Wait for bootstrap to complete | |
timeout-minutes: 8 | |
run: | | |
set -exo pipefail | |
sleep 60 | |
kubectl wait --for=condition=ready \ | |
--timeout=240s \ | |
pod/ceramic-0-0 \ | |
-n ${THIS_TEST_NAMESPACE} | |
sleep 60 | |
kubectl wait --for=condition=complete \ | |
--timeout=120s \ | |
job/bootstrap \ | |
-n ${THIS_TEST_NAMESPACE} | |
- name: Template simulation | |
run: | | |
set -exo pipefail | |
yq e '.metadata.namespace = env(THIS_TEST_NAMESPACE)' performance/$TEST_NAME/simulation.yaml \ | |
> performance/$THIS_TEST/simulation.yaml | |
cat performance/$THIS_TEST/simulation.yaml | |
- name: Run simulation | |
run: | | |
set -exo pipefail | |
kubectl apply -f performance/$THIS_TEST/simulation.yaml | |
SIMULATION_RUNTIME=$(yq e '.spec.runTime' performance/$THIS_TEST/simulation.yaml) | |
echo "SIMULATION_RUNTIME=${SIMULATION_RUNTIME}" >> $GITHUB_ENV | |
- name: Notify Discord | |
env: | |
SIMULATION_STATUS_TAG: "Simulation $THIS_TEST started" | |
SIMULATION_COLOR: 3066993 | |
run: | | |
set -exo pipefail | |
envsubst < notifications/notification-template.json > message.json | |
cat message.json | |
curl -v -H "Content-Type: application/json" -X POST -d @./message.json "${{ secrets.DISCORD_WEBHOOK_URL_SUCCEEDED }}" | |
- name: Wait for simulation to complete | |
run: | | |
set -exo pipefail | |
sleep ${SIMULATION_RUNTIME} | |
- name: Cleanup | |
if: always() | |
run: | | |
kubectl delete -f performance/$THIS_TEST/network.yaml |