2022-06-09 15:44:58 -04:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
2022-06-10 08:58:51 -04:00
|
|
|
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
|
|
|
|
|
2022-06-09 15:44:58 -04:00
|
|
|
jobs:
|
2022-06-09 15:54:19 -04:00
|
|
|
tests:
|
2022-06-09 15:44:58 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Development Code
|
2022-06-09 19:54:57 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-06-09 15:54:19 -04:00
|
|
|
- name: Setup Node
|
2022-06-09 19:54:59 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-06-09 15:44:58 -04:00
|
|
|
with:
|
2022-06-09 15:54:19 -04:00
|
|
|
node-version: 18.x
|
2022-06-09 15:44:58 -04:00
|
|
|
- run: npm install
|
2022-06-27 14:00:00 -04:00
|
|
|
- run: npm run lint
|
2022-06-09 15:44:58 -04:00
|
|
|
- run: npm test
|
|
|
|
- run: npm run build --if-present
|
2022-06-09 19:21:33 -04:00
|
|
|
# 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
|
2022-06-10 08:58:51 -04:00
|
|
|
echo "$PR_NUMBER" > ./pr/pr_number
|
2022-06-09 19:21:33 -04:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: pr_number
|
|
|
|
path: pr/
|
2022-06-17 10:07:05 -04:00
|
|
|
|
|
|
|
cypress-run:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2022-06-17 11:18:34 -04:00
|
|
|
- name: Checkout Frontend
|
2022-06-17 10:12:18 -04:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: spiffworkflow-frontend
|
2022-06-17 11:18:34 -04:00
|
|
|
- name: Checkout Backend
|
2022-06-17 10:12:18 -04:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: sartography/spiffworkflow-backend
|
|
|
|
path: spiffworkflow-backend
|
2022-06-17 11:18:34 -04:00
|
|
|
- name: Checkout Samples
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: sartography/sample-process-models
|
|
|
|
path: sample-process-models
|
2022-07-11 17:30:50 -04:00
|
|
|
- name: start_keycloak
|
|
|
|
working-directory: ./spiffworkflow-backend
|
|
|
|
run: ./bin/start_keycloak
|
2022-06-17 10:07:05 -04:00
|
|
|
- name: start_backend
|
|
|
|
working-directory: ./spiffworkflow-backend
|
|
|
|
run: ./bin/build_and_run_with_docker_compose
|
2022-07-11 22:37:22 -04:00
|
|
|
timeout-minutes: 20
|
2022-06-24 11:04:10 -04:00
|
|
|
env:
|
2022-06-24 17:27:00 -04:00
|
|
|
SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA: "true"
|
2022-06-17 10:07:05 -04:00
|
|
|
- name: start_frontend
|
|
|
|
working-directory: ./spiffworkflow-frontend
|
|
|
|
run: ./bin/build_and_run_with_docker_compose
|
2022-06-17 10:35:38 -04:00
|
|
|
- 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
|
2022-07-06 17:14:16 -04:00
|
|
|
- name: wait_for_keycloak
|
|
|
|
working-directory: ./spiffworkflow-backend
|
|
|
|
run: ./bin/wait_for_keycloak 5
|
2022-06-17 10:07:05 -04:00
|
|
|
- name: Cypress run
|
|
|
|
uses: cypress-io/github-action@v4
|
2022-06-17 10:13:35 -04:00
|
|
|
with:
|
|
|
|
working-directory: ./spiffworkflow-frontend
|
2022-06-17 11:05:14 -04:00
|
|
|
browser: chrome
|
2022-07-12 19:43:56 -04:00
|
|
|
# only record on push, not pull_request, since we do not have secrets for PRs,
|
|
|
|
# so the required CYPRESS_RECORD_KEY will not be available.
|
|
|
|
record: ${{ github.event_name == 'push' }}
|
2022-06-17 11:05:14 -04:00
|
|
|
env:
|
|
|
|
# pass the Dashboard record key as an environment variable
|
|
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
|
|
# pass GitHub token to allow accurately detecting a build vs a re-run build
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-07-08 10:56:33 -04:00
|
|
|
- name: get_backend_logs_from_docker_compose
|
|
|
|
if: failure()
|
|
|
|
working-directory: ./spiffworkflow-backend
|
|
|
|
run: ./bin/get_logs_from_docker_compose >./log/docker_compose.log
|
2022-07-07 10:20:23 -04:00
|
|
|
- name: Upload logs
|
|
|
|
if: failure()
|
|
|
|
uses: "actions/upload-artifact@v3.0.0"
|
|
|
|
with:
|
2022-07-07 11:02:08 -04:00
|
|
|
name: spiffworkflow-backend-logs
|
2022-07-22 11:38:33 -04:00
|
|
|
path: "./spiffworkflow-backend/log/*.log"
|
2022-07-19 17:17:52 -04:00
|
|
|
|
|
|
|
# https://github.com/cypress-io/github-action#artifacts
|
|
|
|
- name: upload_screenshots
|
|
|
|
uses: actions/upload-artifact@v2
|
2022-07-26 11:11:23 -04:00
|
|
|
if: failure()
|
2022-07-19 17:17:52 -04:00
|
|
|
with:
|
|
|
|
name: cypress-screenshots
|
|
|
|
path: ./spiffworkflow-frontend/cypress/screenshots
|
|
|
|
# Test run video was always captured, so this action uses "always()" condition
|
|
|
|
- name: upload_videos
|
|
|
|
uses: actions/upload-artifact@v2
|
2022-07-26 11:11:23 -04:00
|
|
|
if: failure()
|
2022-07-19 17:17:52 -04:00
|
|
|
with:
|
|
|
|
name: cypress-videos
|
|
|
|
path: ./spiffworkflow-frontend/cypress/videos
|