build: Update python, testing, and front-end libraries #542
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: MLSB Pull-Request Reviews | |
on: | |
pull_request: | |
branches: | |
- master | |
- main | |
- development | |
push: | |
branches: | |
- master | |
- main | |
- development | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --max-complexity=20 --max-line-length=127 --statistics --exclude=api/__init__.py,api/tqdm.py,api/commands.py,api/app.py,venv/*,ui-testing/*,api/tests/conftest.py,api/model.py --ignore=E712,W503,W504 | |
pytest: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Test with pytest | |
run: | | |
pip install coverage | |
export FLASK_ENV="development" | |
coverage run --omit */api/test/*,initDB.py,tqdm.py,venv/* -m pytest api/tests/website/test_team_captain.py -s | |
coverage run --omit */api/test/*,initDB.py,tqdm.py,venv/* -m pytest -s | |
coverage xml | |
coverage html | |
- name: Create Coverage report Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-pytest | |
path: htmlcov | |
- name: Upload Coverage report to CodeCov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
flags: unittests # optional | |
name: pytest | |
token: ${{ secrets.CODECOV_TOKEN }} | |
cypress: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set up npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: UI Test with cypress | |
run: | | |
export CYPRESS_baseUrl=http://localhost:8080/ | |
# run the server just in-memory | |
nohup python -m flask --app api/app run --host=0.0.0.0 --port=8080 --debug 2>&1 & | |
# now run the cypres tests against it | |
cd ui-testing | |
npm install | |
npm run cypress:test | |
- name: Upload Video Run | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-videos | |
path: ui-testing/cypress/videos |