Skip to content

Commit

Permalink
[MRG] Merge pull request #513 from dfir-iris/graphql_documentation
Browse files Browse the repository at this point in the history
CI/CD: GraphQL documentation spectaql
  • Loading branch information
whikernel authored Jul 11, 2024
2 parents c38d973 + 2d9350a commit 49fd82b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,21 @@ jobs:
# or maybe the docker building phase should also be part of the tests
# and we should build different dockers according to the scenarios? This sounds like an issue to me...
cp tests/data/basic.env .env
docker compose build
docker compose -f docker-compose.dev.yml build
- name: Run tests
working-directory: tests
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
PYTHONUNBUFFERED=true python -m unittest --verbose
- name: Documentation
run: |
docker compose -f docker-compose.dev.yml up --detach
npx --yes spectaql source/spectaql/config.yml
docker compose down
- uses: actions/upload-artifact@v4
with:
name: GraphQL DFIR-IRIS documentation
path: public
if-no-files-found: error
21 changes: 21 additions & 0 deletions source/spectaql/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
spectaql:
logoFile: source/app/static/assets/img/logo-full-blue.png

introspection:
url: http://127.0.0.1:8000/graphql
headers:
Authorization: Bearer B8BA5D730210B50F41C06941582D7965D57319D5685440587F98DFDC45A01594

extensions:
graphqlScalarExamples: true

info:
title: GraphQL DFIR-IRIS DOCUMENTATION
description: Welcome to DFIR-IRIS GraphQL Documentation.
x-introItems:
- title: IRIS API
description: To use these API endpoint, an API key is needed and can be found in every user profile under My settings > API Key.

servers:
- url: https://v200.beta.dfir-iris.org/#
production: true
9 changes: 5 additions & 4 deletions tests/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

class DockerCompose:

def __init__(self, docker_compose_path):
def __init__(self, docker_compose_path, docker_compose_file):
self._docker_compose_path = docker_compose_path
self._docker_compose_file = docker_compose_file

def start(self):
subprocess.check_call(_DOCKER_COMPOSE + ['-f', 'docker-compose.dev.yml', 'up', '--detach'], cwd=self._docker_compose_path)
subprocess.check_call(_DOCKER_COMPOSE + ['-f', self._docker_compose_file, 'up', '--detach'], cwd=self._docker_compose_path)

def extract_all_logs(self):
return subprocess.check_output(_DOCKER_COMPOSE + ['-f', 'docker-compose.dev.yml', 'logs', '--no-color'], cwd=self._docker_compose_path, universal_newlines=True)
return subprocess.check_output(_DOCKER_COMPOSE + ['-f', self._docker_compose_file, 'logs', '--no-color'], cwd=self._docker_compose_path, universal_newlines=True)

def stop(self):
subprocess.check_call(_DOCKER_COMPOSE + ['-f', 'docker-compose.dev.yml', 'down', '--volumes'], cwd=self._docker_compose_path)
subprocess.check_call(_DOCKER_COMPOSE + ['-f', self._docker_compose_file, 'down', '--volumes'], cwd=self._docker_compose_path)
2 changes: 1 addition & 1 deletion tests/iris.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class Iris:

def __init__(self):
self._docker_compose = DockerCompose(_IRIS_PATH)
self._docker_compose = DockerCompose(_IRIS_PATH, 'docker-compose.dev.yml')
self._api = RestApi(API_URL, _API_KEY)
self._administrator = User(API_URL, _API_KEY)

Expand Down

0 comments on commit 49fd82b

Please # to comment.