v1.12.0 #451
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: Cypress Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
cypress-run: | |
runs-on: ubuntu-latest | |
# Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
# Also see warning here https://github.com/cypress-io/github-action#parallel | |
strategy: | |
fail-fast: false # https://github.com/cypress-io/github-action/issues/48 | |
matrix: | |
containers: [1, 2] # Uses 2 parallel instances | |
services: | |
test_db: | |
image: postgres:16-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: localcrag_test | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.11 | |
- name: Install pipenv | |
run: pip install pipenv | |
- name: Installing pipenv dependencies | |
run: | | |
cd server/src | |
pipenv install | |
- name: Setup database | |
run: | | |
export PGPASSWORD='postgres'; psql -h 0.0.0.0 -p 5432 -U postgres -d localcrag_test < server/scripts/create_uuid_extension.sql | |
cd server && PYTHONPATH=.:src LOCALCRAG_CONFIG=config/test-ci-e2e.cfg pipenv run python3 scripts/setup_cypress_db.py | |
- name: Copy assets | |
run: | | |
mkdir server/src/uploads | |
cp server/tests/assets/1847c84526574b0f9a15f258cf9a0de8_l.jpeg server/src/uploads/1847c84526574b0f9a15f258cf9a0de8_l.jpeg | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
start: npm run start:cypress-test-backend, npm run start | |
wait-on: 'http://127.0.0.1:5000/api/health, http://localhost:4200' | |
record: true | |
parallel: true # Runs test in parallel using settings above | |
working-directory: 'client' | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SPACES_SECRET_KEY: ${{ secrets.SPACES_SECRET_KEY }} | |
SPACES_ACCESS_KEY: ${{ secrets.SPACES_ACCESS_KEY }} | |
SPACES_ENDPOINT: ${{ secrets.SPACES_ENDPOINT }} | |
SPACES_REGION: ${{ secrets.SPACES_REGION }} | |
SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }} |