Run OAM tests on prod env #2639
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 OAM tests on prod env | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "*/30 * * * *" | |
jobs: | |
tests: | |
name: Run OAM tests | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
env: | |
ENVIRONMENT: "prod" | |
SLACK_BOT_USER_OAUTH_TOKEN: ${{secrets.PLAYWRIGHT_TOKEN_OAM }} | |
TEST_OAM: true | |
GMAIL_TO_AUTH: ${{ secrets.GMAIL_TO_AUTH }} | |
GMAIL_PASSWORD_TO_AUTH: ${{ secrets.GMAIL_PASSWORD_TO_AUTH }} | |
EMAILS_TO_NOTIFY: ${{secrets.EMAILS_TO_NOTIFY}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "21" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Create .env file | |
shell: bash | |
run: | | |
rm -rf .env.playwright | |
echo "SLACK_BOT_USER_OAUTH_TOKEN=${SLACK_BOT_USER_OAUTH_TOKEN}" >> .env.playwright | |
echo "ENVIRONMENT=$ENVIRONMENT" >> .env.playwright | |
echo "TEST_OAM=$TEST_OAM" >> .env.playwright | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v4 | |
env: | |
cache-name: playwright-cache | |
with: | |
path: | | |
~/.npm | |
~/.cache/ms-playwright/ | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-name }} | |
${{ runner.os }}- | |
- name: Update playwright and install dependencies | |
shell: bash | |
run: | | |
pnpm add -g playwright@latest | |
pnpm add -D @playwright/test@latest | |
npx playwright install --with-deps | |
- name: Run OAM tests | |
run: npx playwright test oam.spec.ts | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Send email if job failed | |
uses: dawidd6/action-send-mail@v4 | |
if: ${{ failure() }} | |
with: | |
server_address: smtp.gmail.com | |
username: ${{env.GMAIL_TO_AUTH}} | |
password: ${{env.GMAIL_PASSWORD_TO_AUTH}} | |
server_port: 465 | |
subject: We're OAM tests and we have failed! | |
from: OAM Hero | |
to: ${{env.EMAILS_TO_NOTIFY}} | |
body: | | |
OAM tests job's failed. | |
Please check oam-monitoring channel in Kontur Slack for details (https://konturio.slack.com/archives/C085AP9HE2C). | |
Also check workflow runs page for even more details (https://github.com/konturio/front-facing-api-tests/actions/workflows/oam-tests.yml). | |
Thanks, your OAM Hero. |