mirror of
https://github.com/sartography/spiffworkflow-frontend.git
synced 2025-02-23 19:58:25 +00:00
77 lines
2.4 KiB
YAML
77 lines
2.4 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
- push
|
|
- pull_request
|
|
|
|
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
|
|
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Development Code
|
|
uses: actions/checkout@v3
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18.x
|
|
- run: npm install
|
|
- run: npm test
|
|
- run: npm run build --if-present
|
|
# part about saving PR number and then using it from auto-merge-dependabot-prs from:
|
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
|
|
- name: Save PR number
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
run: |
|
|
mkdir -p ./pr
|
|
echo "$PR_NUMBER" > ./pr/pr_number
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: pr_number
|
|
path: pr/
|
|
|
|
cypress-run:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: spiffworkflow-frontend
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: sartography/spiffworkflow-backend
|
|
path: spiffworkflow-backend
|
|
- name: start_backend
|
|
working-directory: ./spiffworkflow-backend
|
|
run: ./bin/build_and_run_with_docker_compose
|
|
- name: start_frontend
|
|
working-directory: ./spiffworkflow-frontend
|
|
run: ./bin/build_and_run_with_docker_compose
|
|
- name: wait_for_backend
|
|
working-directory: ./spiffworkflow-backend
|
|
run: ./bin/wait_for_server_to_be_up 5
|
|
- name: wait_for_frontend
|
|
working-directory: ./spiffworkflow-frontend
|
|
run: ./bin/wait_for_frontend_to_be_up 5
|
|
- name: Cypress run
|
|
uses: cypress-io/github-action@v4
|
|
with:
|
|
working-directory: ./spiffworkflow-frontend
|
|
|
|
# https://github.com/cypress-io/github-action#artifacts
|
|
- uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: cypress-screenshots
|
|
path: ./spiffworkflow-frontend/cypress/screenshots
|
|
# Test run video was always captured, so this action uses "always()" condition
|
|
- uses: actions/upload-artifact@v2
|
|
if: always()
|
|
with:
|
|
name: cypress-videos
|
|
path: ./spiffworkflow-frontend/cypress/videos
|