Skip to content

Commit

Permalink
Merge branch 'master' into playwright_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
akiva10b committed Mar 4, 2024
2 parents 82536d2 + a04eb99 commit 0550d7f
Show file tree
Hide file tree
Showing 195 changed files with 6,945 additions and 3,913 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/continuous.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Continuous
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

concurrency:
group: ${{ github.ref }}
Expand Down Expand Up @@ -93,6 +89,8 @@ jobs:
# cache-to: type=registry,ref=gcr.io/${{ secrets.DEV_PROJECT }}/sefaria-${{ matrix.app }}/cache, mode=max
context: .
push: true
build-args: |
TYPE=build
file: ./build/${{ matrix.app }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down Expand Up @@ -198,6 +196,9 @@ jobs:
run: cat /home/runner/jestResults.json; STATUS=`jq ".numFailedTestSuites" /home/runner/jestResults.json`; exit $STATUS
if: ${{ always() }}
sandbox-deploy:
concurrency:
group: dev-mongo
cancel-in-progress: false
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: build-derived
Expand Down Expand Up @@ -267,6 +268,9 @@ jobs:
WAIT_DURATION: "3000"
GIT_COMMIT: "${{ steps.get-sha.outputs.sha_short }}"
pytest-job:
concurrency:
group: dev-mongo
cancel-in-progress: false
if: ${{ github.event_name == 'pull_request' }}
name: "PyTest" # This name is referenced when slacking status
needs:
Expand Down Expand Up @@ -311,12 +315,10 @@ jobs:
| sed 's/[^a-z0-9\.\-]//g')
>> $GITHUB_OUTPUT
- name: Start Job
run: envsubst '${GITHUB_RUN_ID},${DEPLOY_ENV},${WEB_IMAGE_NAME},${WEB_IMAGE_TAG},${TIMESTAMP}' < ./build/ci/pyTestPod.yaml | kubectl apply -f -
run: ./build/ci/createJobFromRollout.sh $GITHUB_RUN_ID $DEPLOY_ENV
env:
# dependent on GITHUB_RUN_ID, which is implicitly passed in
DEPLOY_ENV: sandbox-${{ steps.get-sha.outputs.sha_short }}
WEB_IMAGE_NAME: us-east1-docker.pkg.dev/${{secrets.DEV_PROJECT}}/containers/sefaria-web-${{ steps.branch-name.outputs.current_branch }}
WEB_IMAGE_TAG: sha-${{ steps.get-sha.outputs.sha_short }}
- name: Wait For Job To Finish
run: ./build/ci/waitForCIJob.bash
timeout-minutes: 60
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ jobs:
id: semantic
with:
working_directory: ./helm-chart
semantic_version: 18.0.1
extra_plugins: |
[email protected]
@semantic-release/[email protected]
[email protected]
@semantic-release/[email protected]
extends: |
semantic-release-monorepo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/production-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ jobs:
# cache-to: type=registry,ref=$gcr.io/${{ secrets.PROD_GKE_PROJECT }}/{{ secrets.IMAGE_NAME }}-${{ matrix.app }}/cache,mode=max
context: .
push: true
build-args: |
TYPE=build-prod
file: ./build/${{ matrix.app }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down Expand Up @@ -218,7 +220,6 @@ jobs:
IMAGE_NAME: "${{ secrets.IMAGE_NAME }}"
CHART_VERSION: "${{ steps.chart_version.outputs.chart_version }}"
- name: Update workflow default chart
if: github.ref == 'refs/heads/master'
run: >
curl -L
-X PATCH
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ node_modules
#####################
venv/
.python-version
.node-version

# Partner files #
#################
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use an official Python runtime as a parent image
FROM python:3.7-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install psycopg2 dependencies
RUN apt-get update && apt-get install -y libpq-dev

# Install gcc
RUN apt-get update && apt-get install -y gcc

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Define environment variable
ENV NAME Sefaria-Project

# Run app.py when the container launches
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
314 changes: 12 additions & 302 deletions README.mkd

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions api/api_warnings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import django
django.setup()
from sefaria.model import *
from typing import List
from enum import Enum

class APIWarningCode(Enum):
APINoVersion = 101
APINoLanguageVersion = 102
APINoSourceText = 103
APINoTranslationText = 104

"""
classes for data warnings in API calls.
used when part of the data that was requested exists and returned, and part is missing.
"""

class APIDatawarning():
"""
general class
"""

def __init__(self):
pass


class TextsAPIResponseMessage(APIDatawarning):
"""
class for returning a message and an warning code
"""

def get_message(self) -> dict:
return {'warning_code': self.warning_code.value,
'message': self.message}


class APINoVersion(TextsAPIResponseMessage):

def __init__(self, oref: Ref, vtitle: str, lang: str):
self.warning_code = APIWarningCode.APINoVersion
self.message = f'We do not have version named {vtitle} with language {lang} for {oref}'


class APINoLanguageVersion(TextsAPIResponseMessage):

def __init__(self, oref: Ref, langs: List[str]):
self.warning_code = APIWarningCode.APINoLanguageVersion
self.message = f'We do not have the language you asked for {oref}. Available languages are {langs}'


class APINoSourceText(TextsAPIResponseMessage):

def __init__(self, oref: Ref):
self.warning_code = APIWarningCode.APINoSourceText
self.message = f'We do not have the source text for {oref}'


class APINoTranslationText(TextsAPIResponseMessage):

def __init__(self, oref: Ref):
self.warning_code = APIWarningCode.APINoTranslationText
self.message = f'We do not have a translation for {oref}'
Loading

0 comments on commit 0550d7f

Please sign in to comment.