aurweb/.gitlab-ci.yml
Kevin Morris e865a6347f .gitlab-ci.yml: enforce isort and flake8 compliance
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 21:31:57 -07:00

57 lines
2.6 KiB
YAML

image: archlinux
cache:
key: system-v1
paths:
# For some reason Gitlab CI only supports storing cache/artifacts in a path relative to the build directory
- .pkg-cache
variables:
AUR_CONFIG: conf/config
before_script:
- pacman -Syu --noconfirm --noprogressbar --needed --cachedir .pkg-cache
base-devel git gpgme protobuf pyalpm python-mysqlclient
python-pygit2 python-srcinfo python-bleach python-markdown
python-sqlalchemy python-alembic python-pytest python-werkzeug
python-pytest-tap python-fastapi hypercorn nginx python-authlib
python-itsdangerous python-httpx python-jinja python-pytest-cov
python-requests python-aiofiles python-python-multipart
python-pytest-asyncio python-coverage python-bcrypt
python-email-validator openssh python-lxml mariadb
python-isort flake8
- bash -c "echo '127.0.0.1' > /etc/hosts"
- bash -c "echo '::1' >> /etc/hosts"
- mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
- mysql -u root -e "CREATE USER 'aur'@'localhost' IDENTIFIED BY 'aur';"
- mysql -u root -e "CREATE DATABASE aurweb;"
- mysql -u root -e "GRANT ALL PRIVILEGES ON aurweb.* TO 'aur'@'localhost';"
- mysql -u root -e "FLUSH PRIVILEGES;"
- sed -r "s;YOUR_AUR_ROOT;$(pwd);g" conf/config.dev > conf/config
- cp conf/config conf/config.sqlite
- cp conf/config.defaults conf/config.sqlite.defaults
- sed -i -r 's;backend = .*;backend = sqlite;' conf/config.sqlite
- sed -i -r "s;name = .*;name = $(pwd)/aurweb.sqlite3;" conf/config.sqlite
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
test:
script:
- python setup.py install
- make -C po all install
- python -m aurweb.initdb
- make -C test sh # sharness tests use sqlite.
- make -C test pytest # pytest with mysql.
- AUR_CONFIG=conf/config.sqlite make -C test pytest # pytest with sqlite.
- coverage report --include='aurweb/*'
- coverage xml --include='aurweb/*'
- flake8 --count aurweb # Assert no flake8 violations in aurweb.
- flake8 --count test # Assert no flake8 violations in test.
- flake8 --count migrations # Assert no flake8 violations in migrations.
- isort --check-only aurweb # Assert no isort violations in aurweb.
- isort --check-only test # Assert no flake8 violations in test.
- isort --check-only migrations # Assert no flake8 violations in migrations.
artifacts:
reports:
cobertura: coverage.xml