Skip to content

Commit

Permalink
Merge pull request #31 from ISSResearch/feat-ci
Browse files Browse the repository at this point in the history
Feat ci
  • Loading branch information
githubering182 authored Mar 11, 2024
2 parents 2fb9c97 + a389678 commit 677cc4f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 25 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests CI

on:
push:
branches-ignore:
- main

jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Build Images
run: docker-compose -f docker-compose.test.yml build

test:
runs-on: self-hosted
needs: build
steps:
- name: Run Tests
run: |
docker-compose -f docker-compose.test.yml up -d --force-recreate
sleep 30
docker exec iss-test-front npm run lint
docker exec iss-tests flake8
docker exec iss-test-front npm run test
# docker exec iss-test-front npm run compile
docker exec iss-test-back ./manage.py test
docker exec iss-test-storage python3 src/test.py
# docker exec iss-tests python3 test.py
clean:
runs-on: self-hosted
needs: test
steps:
- name: Clean up
run: |
docker-compose -f docker-compose.test.yml down --volumes --remove-orphans
docker system prune --all --volumes --force

18 changes: 0 additions & 18 deletions .gitlab-ci.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ FROM node:20.4-slim

WORKDIR /app

COPY ./frontend-app/*.json/ ./
COPY ./frontend-app/package.json ./
COPY ./frontend-app/tsconfig.json ./
COPY ./frontend-app/.eslintrc.json ./

RUN npm install

Expand Down
15 changes: 10 additions & 5 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.8"
version: "3.7"

services:
iss-test-db:
Expand Down Expand Up @@ -26,6 +26,7 @@ services:
image: iss_back_tst
build:
dockerfile: Dockerfile.backend
context: .
restart: always
depends_on:
- iss-test-db
Expand All @@ -35,7 +36,7 @@ services:
DB_HOST: iss-test-db
DB_NAME: iss_test_app_db
CASE: test
DEBUG: true
DEBUG: "true"
SERVER_ORIGINS: "iss-test-front,iss-test-back"
SECRET_KEY: test-secret-key
command: >
Expand All @@ -54,13 +55,14 @@ services:
image: iss_storage_tst
build:
dockerfile: Dockerfile.storage
context: .
restart: always
environment:
DB_HOST: iss-test-storage-db
APP_BACKEND_URL: iss-test-back:8000
DB_USER: testuser
DB_PASSWORD: testuserpass
DEBUG: true
DEBUG: "true"
CELERY_BROKER_URL: redis://iss-test-broker:6379/0
SECRET_KEY: test-secret-key
depends_on:
Expand All @@ -82,13 +84,14 @@ services:
container_name: iss-test-worker
build:
dockerfile: Dockerfile.storage
context: .
restart: always
environment:
DB_HOST: iss-test-storage-db
APP_BACKEND_URL: iss-test-back:8000
DB_USER: testuser
DB_PASSWORD: testuserpass
DEBUG: true
DEBUG: "true"
CELERY_BROKER_URL: redis://iss-test-broker:6379/0
SECRET_KEY: test-secret-key
depends_on:
Expand All @@ -103,12 +106,13 @@ services:
image: iss_front_tst
build:
dockerfile: Dockerfile.frontend
context: .
restart: always
depends_on:
- iss-test-back
environment:
CASE: test
CI: true
CI: "true"
command: npm start
networks:
- iss_test_network
Expand All @@ -118,6 +122,7 @@ services:
image: iss_tests
build:
dockerfile: Dockerfile.tests
context: .
# depends_on:
# - iss-selenium-chrome
# - iss-selenium-fox
Expand Down
2 changes: 1 addition & 1 deletion storage-app/src/shared/app_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _stream_dataset(self) -> StreamingResponse:
# TODO: find a way to defer closing maybe i could overpass the iterator
async def _iterator(self) -> AsyncGenerator[bytes, None]:
self.file.seek(self.chunk_start)
remaining: int = self.chunk_end
remaining: int = self.chunk_length

while remaining and (chunk := await self.file.read(CHUNK_SIZE)):
remaining -= CHUNK_SIZE if CHUNK_SIZE <= remaining else remaining
Expand Down

0 comments on commit 677cc4f

Please sign in to comment.