fixed 8 issues #27
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: React Ecommerce Test Runner by JobSimulator.Dev | |
on: | |
pull_request_target: | |
branches: ["main"] | |
permissions: write-all | |
jobs: | |
check_is_signed_up: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
status: [200] | |
steps: | |
- name: Set up environment variables | |
env: | |
USER_ID: ${{ github.event.sender.id }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
echo "USER_ID=${USER_ID}" >> $GITHUB_ENV | |
echo "GH_TOKEN=${GH_TOKEN}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Call API endpoint | |
if: ${{ matrix.status == 200 }} | |
run: | | |
status_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST -d "${USER_ID}" https://jobsim-pr-user-check.deno.dev) | |
if [ $status_code -ne 200 ]; then | |
gh pr review ${{ github.event.number }} --comment --body "It looks like your GitHub account is not registered with JobSimulator.Dev. Please sign up at https://www.jobsimulator.dev to have your PR be tested automatically. Once you've signed up, close and open your PR to start the tests. Thanks!" | |
exit 1 | |
fi | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v1.31.0-focal | |
needs: check_is_signed_up | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # checkout the PR branch | |
- uses: actions/setup-node@v3 # setup node | |
with: | |
node-version: 18 | |
- run: rm -rf tests # remove any user provided test dir | |
- uses: actions/checkout@v3 # checkout tests repo | |
with: | |
repository: developer-job-simulation/react-ecommerce-tests | |
path: tests | |
- name: Install dependencies | |
run: npm ci && cd tests && npm ci | |
- name: start frontend | |
run: npm run dev:frontend & | |
- name: start backend | |
run: npm run dev:backend > /logs.txt & | |
- name: Run Tests | |
run: node tests/test.js | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs | |
path: /logs.txt | |
- name: Upload screenshot | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshot | |
path: /test.png |