mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-10-31 13:37:42 +00:00
ci: configure tests with zuul
Change-Id: Idc12626b86f2011259acd97c4d69c79f910fb12d Reviewed-on: https://gerrit.stoatinternal.com/c/stoatchat/+/227 Tested-by: Zuul Reviewed-by: insert <insert@stoat.chat>
This commit is contained in:
22
.zuul.yaml
Normal file
22
.zuul.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
- job:
|
||||
name: stoatchat-rust
|
||||
parent: rust-docker
|
||||
description: Build the workspace and run the tests against the reference and MongoDB databases.
|
||||
nodeset:
|
||||
nodes:
|
||||
- name: container
|
||||
label: pod-rust
|
||||
- name: docker
|
||||
label: docker-namespace
|
||||
semaphores:
|
||||
- stoatchat-rust
|
||||
run: .zuul/playbooks/rust.yaml
|
||||
timeout: 3600
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- stoatchat-rust
|
||||
gate:
|
||||
jobs:
|
||||
- stoatchat-rust
|
||||
13
.zuul/compose.mirror.yml
Normal file
13
.zuul/compose.mirror.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
redis:
|
||||
image: docker.io/eqalpha/keydb
|
||||
database:
|
||||
image: docker.io/library/mongo
|
||||
minio:
|
||||
image: docker.io/pgsty/silo
|
||||
createbuckets:
|
||||
image: docker.io/pgsty/mc
|
||||
rabbit:
|
||||
image: docker.io/library/rabbitmq:4-management
|
||||
maildev:
|
||||
image: docker.io/maildev/maildev:2.2.1
|
||||
90
.zuul/playbooks/rust.yaml
Normal file
90
.zuul/playbooks/rust.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
- hosts: container
|
||||
tasks:
|
||||
- name: Read the Docker daemon's address
|
||||
command: cat /etc/docker-host
|
||||
register: docker_host_file
|
||||
|
||||
- hosts: container
|
||||
vars:
|
||||
docker_ip: "{{ docker_host_file.stdout | trim }}"
|
||||
environment:
|
||||
PATH: "/root/.local/bin:/root/.local/share/mise/shims:{{ ansible_env.PATH }}"
|
||||
MISE_YES: "1"
|
||||
MISE_DISABLE_TOOLS: node,pnpm,gh,github:git-town/git-town
|
||||
CARGO_TERM_COLOR: always
|
||||
DOCKER_HOST: "tcp://{{ docker_ip }}:2375"
|
||||
tasks:
|
||||
- name: Install system libraries
|
||||
shell: apt-get update && apt-get install --yes libdav1d-dev pkg-config socat
|
||||
|
||||
- name: Install mise
|
||||
shell: curl -fsSL https://mise.run | MISE_VERSION=v2026.10.8 sh
|
||||
|
||||
- name: Install tools
|
||||
shell: |
|
||||
mise trust
|
||||
mise use -g cargo-binstall docker-cli docker-compose
|
||||
mise install
|
||||
mkdir -p ~/.docker/cli-plugins
|
||||
ln -sf "$(mise which docker-compose)" ~/.docker/cli-plugins/docker-compose
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
|
||||
- name: Wait for Docker
|
||||
command: docker info
|
||||
register: docker_info
|
||||
until: docker_info.rc == 0
|
||||
retries: 30
|
||||
delay: 2
|
||||
|
||||
- name: Point the tests at the services on the Docker node
|
||||
shell: cat > Revolt.test-overrides.toml
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
stdin: |
|
||||
[database]
|
||||
mongodb = "mongodb://{{ docker_ip }}:27017/?directConnection=true"
|
||||
redis = "redis://{{ docker_ip }}:6379/"
|
||||
|
||||
[rabbit]
|
||||
host = "{{ docker_ip }}"
|
||||
|
||||
[files.s3]
|
||||
endpoint = "http://{{ docker_ip }}:14009"
|
||||
|
||||
[api.smtp]
|
||||
host = "{{ docker_ip }}"
|
||||
|
||||
- name: Forward maildev's web API, which the tests reach at localhost:14080
|
||||
shell: setsid nohup socat TCP-LISTEN:14080,fork,reuseaddr TCP:{{ docker_ip }}:14080 > /dev/null 2>&1 &
|
||||
|
||||
- name: Start services
|
||||
command: mise run docker:start
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
environment:
|
||||
COMPOSE_FILE: compose.yml:.zuul/compose.mirror.yml
|
||||
|
||||
- name: Build
|
||||
command: mise run build
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
|
||||
- name: Test against the reference database
|
||||
command: mise run test
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
environment:
|
||||
TEST_DB: REFERENCE
|
||||
|
||||
- name: Test against MongoDB
|
||||
command: mise run test
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
environment:
|
||||
TEST_DB: MONGODB
|
||||
MONGODB: "mongodb://{{ docker_ip }}:27017/?directConnection=true"
|
||||
|
||||
- name: Show cache statistics
|
||||
command: sccache --show-stats
|
||||
failed_when: false
|
||||
Reference in New Issue
Block a user