aurweb/.gitlab-ci.yml

41 lines
1.6 KiB
YAML

image: archlinux:base-devel
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 # Default MySQL config setup in before_script.
DB_HOST: localhost
before_script:
- ./docker/scripts/install-deps.sh
- pip install -r requirements.txt
- useradd -U -d /aurweb -c 'AUR User' aur
- ./docker/mariadb-entrypoint.sh
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
- ./docker/test-sqlite-entrypoint.sh # Create sqlite AUR_CONFIG.
- make -C po all install
- python setup.py install --install-scripts=/usr/local/bin
- python -m aurweb.initdb # Initialize MySQL tables.
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
- make -C test clean
test:
script:
- make -C test sh pytest # sharness tests use sqlite & pytest w/ mysql.
- AUR_CONFIG=conf/config.sqlite make -C test pytest
- make -C test coverage # Produce coverage reports.
- 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