fix: publiccode.yml #925
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: uniCMS | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
django-version: | |
- '4.2' | |
- 'master' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# python -m pip install --upgrade tox tox-gh-actions | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 ./src/cms --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 ./src/cms --count --exit-zero --statistics | |
- name: Install Redis | |
run: | | |
sudo apt-get install -y redis-server | |
- name: Start Redis | |
run: sudo systemctl start redis | |
- name: Install MongoDB | |
run: | | |
sudo apt-get install -y gnupg wget | |
sudo wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - | |
sudo echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org | |
- name: Start MongoDB | |
run: sudo systemctl start mongod | |
- name: Install unicms-templates-unical | |
run: pip install unicms_template_unical | |
- name: Test with Django tests | |
working-directory: ./example | |
run: | | |
DJANGO_SETTINGS_MODULE=unicms.settingslocal_test | |
cp unicms/settingslocal_example.py unicms/settingslocal.py | |
./manage.py cms_search_create_mongo_index -y | |
./manage.py unicms_collect_templates -y | |
# ./manage.py test --settings=unicms.settingslocal_test -v 2 | |
coverage erase | |
coverage run ./manage.py test --settings=unicms.settingslocal_test cms | |
coverage report -m | |
coverage report --fail-under=99 | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: example/coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
path_to_write_report: ./codecov_report.txt | |
# verbose: true | |
- name: Bandit Security Scan | |
run: | | |
bandit -r -x tests.py,src/cms/api/tests src/cms/* |