fix: test PR #1
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: Playwright Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
permissions: write-all | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: [self-hosted, linux, staging] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Build | |
run: npm run build:all | |
- name: Run Playwright tests | |
run: npm run test:e2e | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 7 | |
- name: Install AWS CLI | |
run: | | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::424128779646:role/staging-eks-eks_0-github-actions-apptentive-javascript | |
- name: Upload to S3 | |
run: | | |
echo "Check and clean testreport folder if it exist..." | |
if aws s3 ls "s3://apptentive-staging-websdk-testreports/playwright-reports/${{ github.event.pull_request.number }}/" > /dev/null 2>&1; then | |
aws s3 rm "s3://apptentive-staging-websdk-testreports/playwright-reports/${{ github.event.pull_request.number }}/" --recursive | |
fi | |
echo "Copy new testreport..." | |
aws s3 cp playwright-report/ "s3://apptentive-staging-websdk-testreports/playwright-reports/${{ github.event.pull_request.number }}/" --recursive | |
echo "Complete..." | |
- name: Prepare Data | |
id: prepare_data | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
PR_LINK="https://github.com/${{ github.repository }}/pull/$PR_NUMBER" | |
AUTHOR="${{ github.actor }}" | |
S3_LINK="s3://apptentive-staging-websdk-testreports/playwright-reports/${{ github.event.pull_request.number }}/index.html" | |
TEST_RESULT="${{ job.status }}" | |
DATE=$(date +%Y-%m-%d) | |
echo "::set-output name=json_data::{\"pr_number\":\"$PR_NUMBER\",\"pr_link\":\"$PR_LINK\",\"author\":\"$AUTHOR\",\"s3_link\":\"$S3_LINK\",\"test_result\":\"$TEST_RESULT\",\"date\":\"$DATE\"}" | |
- name: Send Data to QA IronMan service | |
run: | | |
curl -X POST "https://qa-iron-man.staging.apptentive.com/qa/websdk-testreports" -H "Content-Type: application/json" -d '${{ steps.prepare_data.outputs.json_data }}' |