Skip to content

Bump semver from 6.3.0 to 6.3.1 in /wp1-frontend (#641) #128

Bump semver from 6.3.0 to 6.3.1 in /wp1-frontend (#641)

Bump semver from 6.3.0 to 6.3.1 in /wp1-frontend (#641) #128

Workflow file for this run

# Run Python unit tests in continuous integration mode.
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
jobs:
python-nose:
runs-on: ubuntu-22.04
services:
# Unit test rely on a local MySQL instance with an empty root password.
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
redis:
# Some unit tests also try to write to Redis
image: redis
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
# Don't need lfs because we're not referencing the dev-db in this workflow.
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Verify MySQL connection from host
run: |
mysql --host 127.0.0.1 --port 3306 -uroot -e "SHOW DATABASES"
- name: Create test databases
run: |
mysql --host 127.0.0.1 --port 3306 -uroot -e 'CREATE DATABASE enwp10_test; CREATE DATABASE enwikip_test;'
- name: Copy credentials
run: |
cp wp1/credentials.py.e2e wp1/credentials.py
cp wp1/credentials.py.dev.e2e wp1/credentials.py.dev
- name: Test with nose
run: |
nosetests --with-coverage
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
frontend-cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v1
name: Cache pip dependencies
id: pip-cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Get yarn cache directory path
id: yarn-dep-cache-dir-path
run: cd wp1-frontend && echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup Yarn dep cache
id: yarn-dep-cache
with:
path: ${{ steps.yarn-dep-cache-dir-path.outputs.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-dep-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-dep-
- name: Install Javascript dependencies
run: cd wp1-frontend && yarn install --frozen-lockfile
- name: Copy credentials
run: |
cp wp1/credentials.py.e2e wp1/credentials.py
cp wp1/credentials.py.dev.e2e wp1/credentials.py.dev
# This is the dev database, the dev redis, and the dev workers.
# We don't technically need that last one.
- name: Start Docker dev services
run: docker compose -f docker-compose-dev.yml up -d --build
- name: Wait for Docker dev services to be up (30s)
run: sleep 30s
shell: bash
- name: Start web API server
timeout-minutes: 2
env:
FLASK_APP: wp1.web.app
FLASK_DEBUG: 1
run: python -m flask run &
- name: Build frontend server
run: |
cd wp1-frontend
yarn build --mode staging
- name: Start frontend server
run: |
cd wp1-frontend
python -m http.server 5173 --directory dist/ &
- name: Wait for API and frontend server to be up (10s)
run: sleep 10s
shell: bash
- name: Run frontend tests
run: |
cd wp1-frontend
$(yarn bin)/cypress run
- name: Stop containers
continue-on-error: true
if: always()
run: docker compose -f "docker-compose-dev.yml" down
- uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
name: screenshots
path: wp1-frontend/cypress/screenshots/*