From b09c9b6be5661b19cc1e42ce320b9b542a649131 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 1 Dec 2024 15:25:53 +1030 Subject: [PATCH] ci: Add e2e heartbeat --- .github/workflows/build.yml | 21 --------------------- .github/workflows/e2e.yml | 29 +++++++++++++++++++++++++++++ load-tests/script.js | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e0c74c..b9a39868 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -410,27 +410,6 @@ jobs: - name: Run tests run: npm test - validate-load-tests: - needs: [check_changes] - runs-on: ubuntu-latest - if: ${{ needs.check_changes.outputs.load_tests == 'true' }} - defaults: - run: - working-directory: load-tests - env: - INFERABLE_TEST_CLUSTER_ID: ${{ secrets.INFERABLE_TEST_CLUSTER_ID }} - INFERABLE_TEST_API_SECRET: ${{ secrets.INFERABLE_TEST_API_SECRET }} - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: npm ci - # Run machine:start backgrounded - - run: npm run machine:start & - - uses: grafana/setup-k6-action@v1 - - uses: grafana/run-k6-action@v1 - with: - path: ./load-tests/script.js - build-load-test-machine-image: runs-on: ubuntu-latest needs: check_changes diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..7539af94 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,29 @@ +on: + schedule: + - cron: "0 * * * *" + pull_request: + branches: + - main + paths: + - 'load-tests/**' + +jobs: + run-e2e: + runs-on: ubuntu-latest + defaults: + run: + working-directory: load-tests + env: + INFERABLE_TEST_CLUSTER_ID: ${{ secrets.INFERABLE_TEST_CLUSTER_ID }} + INFERABLE_TEST_API_SECRET: ${{ secrets.INFERABLE_TEST_API_SECRET }} + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: npm ci + # Run machine:start backgrounded + - run: npm run machine:start & + - uses: grafana/setup-k6-action@v1 + - uses: grafana/run-k6-action@v1 + with: + path: ./load-tests/script.js + - run: curl -X POST https://uptime.betterstack.com/api/v1/heartbeat/hYrsEwXdwJDDqsNmCEjX2umS diff --git a/load-tests/script.js b/load-tests/script.js index 0ff16af6..bb8b5be2 100644 --- a/load-tests/script.js +++ b/load-tests/script.js @@ -18,7 +18,7 @@ export default function () { // Create a new run const postRunResponse = http.post(`${BASE_URL}/clusters/${CLUSTER_ID}/runs`, JSON.stringify({ - initialPrompt: 'Get the special word from from the `searchHaystack` function', + initialPrompt: 'Get the special word from the `searchHaystack` function', resultSchema: { type: 'object', properties: {