Skip to content

Commit

Permalink
chore: always use just to invoke docker in CI (#34)
Browse files Browse the repository at this point in the history
Tests fail in CI sometimes for unknown reasons.
  • Loading branch information
avdb13 authored Feb 23, 2024
1 parent 8891d61 commit c898e03
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,42 @@ jobs:
with:
just-version: '1.13.0'

- name: Create a copy of `.env.example`
run: just dotenv
- name: Retrieve User Permissions
run: |
echo DOCKER_USER=$(id -u):$(id -g) >> $GITHUB_ENV
- name: Create Homeserver Configuration For Synapse
run: just gen_synapse_conf

- name: Use Test Homeserver
run: |
cp ./crates/test/fixtures/synapse/* ./docker/synapse
cat ./docker/synapse/homeserver.yaml
- name: Build Docker Containers
run: |
just backend --no-start
- name: Run Docker Containers
run: |
docker compose up -d --build
sleep 20
just backend -d
- name: Wait for Healthy Container
uses: raschmitt/wait-for-healthy-container@v1.0.1
with:
container-name: commune-rs-synapse-1
timeout: 30

- name: Create Admin User
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
run: just gen_synapse_admin

- name: Check Synapse is Running
run: curl -sSf http://localhost:8008 > /dev/null

- name: Provide Database Backup & Test it
run: |
just backup_db
just nuke_db
just restore_db
- name: Retrieve Admin Access Token
run: |
just get_access_token
grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env | sed "s/'//g" >> $GITHUB_ENV
- name: E2E Tests
env:
COMMUNE_SYNAPSE_ADMIN_TOKEN: ${{ env.COMMUNE_SYNAPSE_ADMIN_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ get_access_token:
)'/" .env

# Runs backend dependency services
backend: dotenv
docker compose up --build
backend *args='': dotenv
docker compose up --build $1

# Stops backend dependency services
stop:
Expand Down
4 changes: 2 additions & 2 deletions crates/test/src/matrix/room_admin.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#[cfg(test)]
mod tests {
use std::{thread, time::Duration};
use std::time::Duration;

use futures::{future, TryFutureExt};
use matrix::{
admin::resources::room::{ListRoomQuery, MessagesQuery, RoomService as AdminRoomService},
ruma_common::{RoomId, ServerName},
ruma_events::{room::name::OriginalRoomNameEvent, AnyTimelineEvent, TimelineEventType},
ruma_events::TimelineEventType,
};

use tokio::sync::OnceCell;
Expand Down

0 comments on commit c898e03

Please sign in to comment.