Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: always use just to invoke docker in CI #34

Merged
merged 13 commits into from
Feb 23, 2024
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/[email protected]
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
Loading