mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
We'll need to update the nginx config to do this; putting
this off into an MR.
This reverts commit 19bd3766d2
.
82 lines
3 KiB
YAML
82 lines
3 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
|
|
TEST_RECURSION_LIMIT: 10000
|
|
CURRENT_DIR: "$(pwd)"
|
|
|
|
test:
|
|
stage: test
|
|
tags:
|
|
- fast-single-thread
|
|
before_script:
|
|
- export PATH="$HOME/.poetry/bin:${PATH}"
|
|
- ./docker/scripts/install-deps.sh
|
|
- ./docker/scripts/install-python-deps.sh
|
|
- 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'
|
|
- cp -v conf/config.dev conf/config
|
|
- sed -i "s;YOUR_AUR_ROOT;$(pwd);g" conf/config
|
|
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
|
|
- make -C po all install
|
|
- make -C test clean
|
|
script:
|
|
# Run sharness.
|
|
- cp logging.conf logging.conf.bak # Copy devel logging.conf to backup
|
|
- cp logging.prod.conf logging.conf # Copy in logging.prod.conf
|
|
- make -C test sh # sharness tests use sqlite.
|
|
- cp logging.conf.bak logging.conf # Restore devel logging.conf
|
|
# Run pytest.
|
|
- pytest # Run pytest suites.
|
|
- 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.
|
|
coverage: '/TOTAL.*\s+(\d+\%)/'
|
|
artifacts:
|
|
reports:
|
|
cobertura: coverage.xml
|
|
|
|
deploy:
|
|
stage: deploy
|
|
tags:
|
|
- secure
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "pu"
|
|
when: manual
|
|
variables:
|
|
FASTAPI_BACKEND: gunicorn
|
|
FASTAPI_WORKERS: 5
|
|
AURWEB_PHP_PREFIX: https://aur-dev.archlinux.org
|
|
AURWEB_FASTAPI_PREFIX: https://aur-dev.archlinux.org
|
|
AURWEB_SSHD_PREFIX: ssh://aur@aur-dev.archlinux.org:2222
|
|
COMMIT_HASH: $CI_COMMIT_SHA
|
|
GIT_DATA_DIR: git_data
|
|
script:
|
|
- cp -vf logging.prod.conf logging.conf # Use production logging.conf
|
|
- pacman -Syu --noconfirm docker docker-compose socat openssh
|
|
- chmod 600 ${SSH_KEY}
|
|
- socat "UNIX-LISTEN:/tmp/docker.sock,reuseaddr,fork" EXEC:"ssh -o UserKnownHostsFile=${SSH_KNOWN_HOSTS} -Ti ${SSH_KEY} ${SSH_USER}@${SSH_HOST}" &
|
|
- export DOCKER_HOST="unix:///tmp/docker.sock"
|
|
# Set secure login config for aurweb.
|
|
- sed -ri "s/^(disable_http_login).*$/\1 = 1/" conf/config.dev
|
|
- docker-compose build
|
|
- docker-compose -f docker-compose.yml -f docker-compose.aur-dev.yml up -d
|
|
- docker image prune -f
|
|
- docker container prune -f
|
|
- docker volume prune -f
|
|
|
|
environment:
|
|
name: development
|
|
url: https://aur-dev.archlinux.org
|