Skip to content

Commit

Permalink
Merge branch 'main' into sdk-0.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuyangh committed Oct 9, 2022
2 parents e4d84a1 + e90bdd2 commit 7278728
Show file tree
Hide file tree
Showing 63 changed files with 466 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ frontend/src/clients/openapi
.env
.husky
.mypy_cache
Dockerfile
Dockerfile
94 changes: 91 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Continuous Integration
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- main
Expand All @@ -12,13 +12,23 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install Python 3
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install node 14.x
uses: actions/setup-node@v2
with:
node-version-file: 'frontend/.nvmrc'
- name: Cache node modules
uses: actions/cache@v3
with:
path: |
node_modules
frontend/node_modules
# yamllint disable rule:line-length
key: node-${{ hashFiles('.nvmrc', 'package-lock.json', 'frontend/package-lock.json') }}
# yamllint enable
- name: Install node components
run: |
npm run gen-api-code
Expand All @@ -27,7 +37,29 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/src/gen/requirements.txt
pip install -r backend/requirements.txt -r backend/src/gen/requirements.txt
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install node 14.x
uses: actions/setup-node@v2
with:
node-version-file: 'frontend/.nvmrc'
- name: Generate code
run: npm run gen-api-code
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt -r backend/src/gen/requirements.txt
- name: Test
run: PYTHONPATH=backend/src/gen python -m unittest discover -v backend/src/tests
timeout-minutes: 10
format:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -68,3 +100,59 @@ jobs:
uses: pre-commit/[email protected]
with:
extra_args: upgrade-type-hints --all-files
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python 3
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: mypy
uses: pre-commit/[email protected]
with:
extra_args: mypy --all-files
lint-requirements-txt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: requirements-txt-fixer --all-files
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: markdownlint-cli2 --all-files
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: yamllint --all-files
lint-trailing-whitespace:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: trailing-whitespace --all-files
lint-eof-newline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint
uses: pre-commit/[email protected]
with:
extra_args: end-of-file-fixer --all-files
4 changes: 3 additions & 1 deletion .github/workflows/py-client-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Python API Client Release"

on:
on: # yamllint disable-line rule:truthy
push:
branches: [main]
paths:
Expand Down Expand Up @@ -34,9 +34,11 @@ jobs:
pip install wheel
- name: generate python client
# yamllint disable rule:line-length
run: |
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.4.0/openapi-generator-cli-5.4.0.jar -O openapi-generator-cli.jar
java -jar openapi-generator-cli.jar generate -i openapi/openapi.yaml -g python -o python_client -t "openapi/python_client_urllib3_templates" "--additional-properties=packageName=explainaboard_api_client,packageVersion=${{ steps.extract_version.outputs.version }}"
# yamllint enable

- name: build
run: |
Expand Down
4 changes: 4 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config:
MD013:
# Number of characters
line_length: 88
16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/python/black.git
rev: 22.3.0
rev: 22.3.0
hooks:
- id: black
files: '\.py$'
Expand Down Expand Up @@ -31,3 +31,17 @@ repos:
additional_dependencies:
- types-requests
files: '\.py$'
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.5.1
hooks:
- id: markdownlint-cli2
- repo: https://github.com/adrienverge/yamllint
rev: v1.28.0
hooks:
- id: yamllint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: requirements-txt-fixer
8 changes: 8 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: default

rules:
line-length:
max: 88
document-start: disable
truthy:
level: error
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global owner
* @neubig @lyuyangh
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
FROM node:14-bullseye-slim as build-step
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
RUN apt-get update && apt-get install -y default-jre wget
RUN apt-get update && apt-get install -y default-jre curl
RUN mkdir ./frontend
COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
WORKDIR /app/frontend
Expand All @@ -24,7 +24,7 @@ RUN npm run build

# Step #2: build the API with the client as static files
FROM python:3.9-slim-bullseye
RUN apt-get update && apt-get install -y default-jre wget nginx
RUN apt-get update && apt-get install -y default-jre curl nginx

WORKDIR /app
RUN python3 -m pip install --upgrade pip
Expand All @@ -35,7 +35,7 @@ COPY ./openapi ./openapi
RUN chmod a+x ./openapi/gen_api_layer.sh
RUN /bin/bash ./openapi/gen_api_layer.sh backend

RUN pip install -r ./backend/src/gen/requirements.txt
RUN pip install -r ./backend/requirements.txt -r ./backend/src/gen/requirements.txt

# Step #3: configure nginx and flask
WORKDIR /app/backend/src/gen
Expand Down
Loading

0 comments on commit 7278728

Please sign in to comment.