Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtun committed Jan 4, 2023
2 parents 000a908 + 66662d9 commit a4a9a7b
Show file tree
Hide file tree
Showing 240 changed files with 49,750 additions and 24,362 deletions.
93 changes: 93 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# devcontainer

## example usage

Below are some example use cases you might want to run from within the
devcontainer (either
[within VSCode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file)
or in your browser via
[GitHub Codespaces](https://github.com/features/codespaces)).

### Run pre-commit

```bash
# run pre-commit
pre-commit run --all-files
```

A successfull run should look something like this:

```
@andrewm4894 ➜ /workspaces/Open-Assistant (devcontainer-improvements) $ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/psf/black:.[jupyter].
[INFO] Initializing environment for https://github.com/pycqa/flake8.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:prettier@2.7.1.
[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
trim trailing whitespace.................................................Passed
check python ast.........................................................Passed
check yaml...............................................................Passed
check json...............................................................Passed
check for case conflicts.................................................Passed
detect private key.......................................................Passed
fix python encoding pragma...............................................Passed
forbid submodules....................................(no files to check)Skipped
mixed line ending........................................................Passed
fix requirements.txt.....................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check BOM - deprecated: use fix-byte-order-marker........................Passed
check for broken symlinks............................(no files to check)Skipped
check for merge conflicts................................................Passed
check for added large files..............................................Passed
fix end of files.........................................................Passed
black-jupyter............................................................Passed
flake8...................................................................Passed
isort....................................................................Passed
prettier.................................................................Passed
Lint website.............................................................Passed
```

### Docker compose

```bash
# build the image
docker compose up --build
```

You should see some docker containers being pulled and activated.

Once you see a line like:

```
open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000
```

you should be able to access that port like below:

<img width="640" alt="image" src="https://user-images.githubusercontent.com/2178292/210395676-e9c2aab5-cb54-4ae6-b1eb-ac929fd73607.png">

this port can then be forwarded to a browser tab like below:

<img width="640" alt="image" src="https://user-images.githubusercontent.com/2178292/210396207-1b2e259f-4d5d-475d-b225-91e2bd004071.png">
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Open-Assistant",
"image": "mcr.microsoft.com/vscode/devcontainers/universal",
"features": {
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {
"version": "latest"
}
},
"postCreateCommand": "bash .devcontainer/post_create_command.sh",
"customizations": {
"vscode": {
"extensions": ["GitHub.copilot"]
}
}
}
2 changes: 2 additions & 0 deletions .devcontainer/post_create_command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ensure pre-commit is installed
pre-commit install
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
4 changes: 2 additions & 2 deletions .github/workflows/build-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_call:

jobs:
build-frontend:
build-frontend:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -22,7 +22,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
cache: "npm"
cache-dependency-path: website/package-lock.json
- run: npm ci
- run: npm run build
30 changes: 30 additions & 0 deletions .github/workflows/test-api-contract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test API Contract

on:
push:
branches:
- main
pull_request:
workflow_call:

jobs:
test-contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: cd oasst-shared && pip install -e .

- run: cd oasst-shared && pip install -r requirements.dev.txt

- run: cd backend && pip install -r requirements.txt

- run: ./scripts/backend-development/start-mock-server.sh

- name: Run contract tests
run: ./scripts/oasst-shared-development/test.sh

- run: ./scripts/backend-development/stop-mock-server.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
*.egg-info
__pycache__
.DS_Store

# Generated files
backend/oasst-openapi.json
45 changes: 36 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
exclude: "build|stubs|^bot/templates/|openassistant/templates"
# WARNING!
#
# When making changes to auto-formatters used in pre-commit hooks, you are
# likely to cause merge conflicts with main and/or other pull requests.
# Fixing them might revert other people's work. Expect pain!
# To avoid accidental reversions and keep it easy to review, please make sure
# that changes here are in a pull request by themselves, that it consists of
# two commits:
#
# 1. The changes to this file
# 2. Changes made by running `python3 -m pre_commit run --all-files`.
#
# Then each time your pull request is blocked by a merge conflict, do the
# following steps:
#
# git reset HEAD^1 && git checkout -f # discard the change commit
# git rebase main # re-apply other people's changes
# python3 -m pre_commit run --all-files # re-run the rules
# git add . # add the newly changed files
# git commit -m 'apply pre-commit' # commit it
# git push -f # force push back to your branch
#
# Keep in mind you may have to do this a few times, as changes here may impact
# other pull requests. Try to keep it up-to-date so they can go in when it'll
# cause least disruption.
#
# /WARNING!

default_language_version:
python: python3
exclude: "build|stubs|^bot/templates/|openassistant/templates/$"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -14,11 +39,12 @@ repos:
# and which break the standard YAML check. The alternative would be to
# skip any unsafe errors (and thus break YAML compatibility) or use
# some other checker that may not work in general.
exclude: "^copilot/web/addons/.*$"
exclude: ^copilot/.*/addons/.*$
- id: check-json
- id: check-case-conflict
- id: detect-private-key
- id: fix-encoding-pragma
args: [--remove]
- id: forbid-submodules
- id: mixed-line-ending
- id: requirements-txt-fixer
Expand All @@ -28,13 +54,13 @@ repos:
- id: check-symlinks
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=1024"]
args: [--maxkb=1024]
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
Expand All @@ -50,14 +76,15 @@ repos:
rev: v2.7.1
hooks:
- id: prettier
args: ["--write"]
args: [--prose-wrap=always, --write]

- repo: local
hooks:
- id: next-lint-website
name: Lint website
files: ^website/
exclude: ^website/node_modules/
types_or: [javascript, jsx, ts, tsx]
language: system
language: node
pass_filenames: false
entry: bash -c 'cd website && npm ci && npm run lint'
entry: website/next-lint.js
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* @yk @andreaskoepf
/website/ @fozziethebeat @k-nearest-neighbor @AbdBarho
/model/ @theblackcat102 @sanagno
/copilot/ @fozziethebeat @andreaskoepf @yk
Loading

0 comments on commit a4a9a7b

Please sign in to comment.