Serverless - Hosts #2303
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: "Serverless - Hosts" | |
on: | |
schedule: | |
# - cron: "0 * * * *" | |
# - cron: "15 * * * *" | |
# - cron: "30 * * * *" | |
- cron: "*/15 * * * *" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
install: | |
timeout-minutes: 60 | |
name: Install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache Playwright binaries | |
uses: actions/cache@v4 | |
id: cache-playwright | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Install Playwright Browsers | |
if: steps.cache-playwright.outputs.cache-hit != 'true' | |
run: npx playwright install --with-deps | |
test_1_day: | |
needs: install | |
name: Run tests (1 day) | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
if: github.event.schedule == '0 * * * *' | |
outputs: | |
is_running: ${{ steps.set_output.outputs.is_running }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Indicate running status | |
id: set_output | |
run: echo "is_running=true" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache Playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('package-lock.json') }} | |
- name: Run Playwright tests | |
run: npx playwright test hosts.serverless.spec.ts --project serverless | |
env: | |
KIBANA_HOST: ${{ secrets.KIBANA_HOST_SERVERLESS }} | |
KIBANA_USERNAME: ${{ secrets.KIBANA_USERNAME_SERVERLESS }} | |
KIBANA_PASSWORD: ${{ secrets.KIBANA_PASSWORD_SERVERLESS }} | |
ELASTICSEARCH_HOST: ${{ secrets.ELASTICSEARCH_HOST_SERVERLESS }} | |
API_KEY: ${{ secrets.API_KEY_SERVERLESS }} | |
TIME_UNIT: ${{ vars.TIME_UNIT }} | |
TIME_VALUE: ${{ vars.TIME_VALUE_X }} | |
- name: Upload test reports | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: /home/runner/work/oblt-playwright/ | |
retention-days: 1 | |
test_7_days: | |
needs: install | |
name: Run tests (7 days) | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
if: github.event.schedule == '*/15 * * * *' | |
outputs: | |
is_running: ${{ steps.set_output.outputs.is_running }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Indicate running status | |
id: set_output | |
run: echo "is_running=true" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache Playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('package-lock.json') }} | |
- name: Run Playwright tests | |
run: npx playwright test hosts.serverless.spec.ts --project serverless | |
env: | |
KIBANA_HOST: ${{ secrets.KIBANA_HOST_SERVERLESS }} | |
KIBANA_USERNAME: ${{ secrets.KIBANA_USERNAME_SERVERLESS }} | |
KIBANA_PASSWORD: ${{ secrets.KIBANA_PASSWORD_SERVERLESS }} | |
ELASTICSEARCH_HOST: ${{ secrets.ELASTICSEARCH_HOST_SERVERLESS }} | |
API_KEY: ${{ secrets.API_KEY_SERVERLESS }} | |
TIME_UNIT: ${{ vars.TIME_UNIT }} | |
TIME_VALUE: ${{ vars.TIME_VALUE_Y }} | |
- name: Upload test reports | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: /home/runner/work/oblt-playwright/ | |
retention-days: 1 | |
test_14_days: | |
needs: install | |
name: Run tests (14 days) | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
if: github.event.schedule == '30 * * * *' | |
outputs: | |
is_running: ${{ steps.set_output.outputs.is_running }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Indicate running status | |
id: set_output | |
run: echo "is_running=true" >> $GITHUB_OUTPUT | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache Playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('package-lock.json') }} | |
- name: Run Playwright tests | |
run: npx playwright test hosts.serverless.spec.ts --project serverless | |
env: | |
KIBANA_HOST: ${{ secrets.KIBANA_HOST_SERVERLESS }} | |
KIBANA_USERNAME: ${{ secrets.KIBANA_USERNAME_SERVERLESS }} | |
KIBANA_PASSWORD: ${{ secrets.KIBANA_PASSWORD_SERVERLESS }} | |
ELASTICSEARCH_HOST: ${{ secrets.ELASTICSEARCH_HOST_SERVERLESS }} | |
API_KEY: ${{ secrets.API_KEY_SERVERLESS }} | |
TIME_UNIT: ${{ vars.TIME_UNIT }} | |
TIME_VALUE: ${{ vars.TIME_VALUE_Z }} | |
- name: Upload test reports | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: /home/runner/work/oblt-playwright/ | |
retention-days: 1 | |
upload: | |
needs: | |
- test_1_day | |
- test_7_days | |
- test_14_days | |
if: always() | |
name: Upload test reports to Elasticsearch | |
runs-on: ubuntu-latest | |
env: | |
REPORTING_CLUSTER_API_KEY: ${{ secrets.REPORTING_CLUSTER_API_KEY }} | |
REPORTING_CLUSTER_ES: ${{ secrets.REPORTING_CLUSTER_ES }} | |
REPORTING_CLUSTER_INDEX: ${{ vars.REPORTING_CLUSTER_INDEX }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Download raw test report from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: /home/runner/work/oblt-playwright/ | |
- name: Upload test report to Elasticsearch | |
run: bash ./src/utils/upload_to_es.sh |