-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
419 additions
and
227 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @elijas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Security | ||
|
||
Alphanome.AI takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations. | ||
|
||
If you believe you have found a security vulnerability in any Alphanome.AI-owned repository, please report it to us as described below. | ||
|
||
## Reporting Security Issues | ||
|
||
**Please do not report security vulnerabilities through public GitHub issues.** | ||
|
||
Instead, please report them to **[email protected]** (alternatively, [email protected]). | ||
|
||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. | ||
|
||
## Preferred Languages | ||
|
||
We prefer all communications to be in English. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI/CD Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
- name: Cache Poetry dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pypoetry | ||
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry-${{ matrix.python-version }}- | ||
${{ runner.os }}-poetry- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run Taskfile "ci-cd-checks" | ||
run: task ci-cd-checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Release to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
- name: Cache Poetry dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pypoetry | ||
key: ${{ runner.os }}-poetry-3.11-${{ hashFiles('**/pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry-3.11- | ||
${{ runner.os }}-poetry- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PUBLIC_PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,86 @@ | ||
version: '3' | ||
|
||
tasks: | ||
|
||
##################################### | ||
### Composite Tasks and Shortcuts ### | ||
##################################### | ||
|
||
pre-commit: | ||
desc: Composite task to run all quick checks. | ||
cmds: | ||
- task unit | ||
- task lint-fix | ||
- task e2e-smoke | ||
|
||
p: | ||
desc: Shortcut for `task pre-commit`. | ||
deps: | ||
- pre-commit | ||
|
||
ci-cd-checks: | ||
desc: Composite task to run all CI/CD checks. | ||
cmds: | ||
- task unit | ||
- task lint | ||
- task e2e | ||
|
||
###################### | ||
### Run Unit Tests ### | ||
###################### | ||
|
||
unit: | ||
desc: Run unit tests and check code coverage. | ||
cmds: | ||
# Recommended coverage viewer in VSCode: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters | ||
- pytest -s --cov --cov-report=lcov:lcov.info --cov-report=term:skip-covered --cov-fail-under=60 tests/unit/ | ||
|
||
unit-watch: | ||
desc: Run unit tests and check code coverage when files change. | ||
desc: Run unit tests and check code coverage immediately when files change. | ||
cmds: | ||
# Recommended coverage viewer in VSCode: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters | ||
- ptw | ||
- ptw -- -s --cov --cov-report=lcov:lcov.info --cov-report=term:skip-covered --cov-fail-under=60 tests/unit/ | ||
|
||
|
||
############################### | ||
### Code Quality Checks ### | ||
############################### | ||
|
||
lint: | ||
desc: Lint the code. | ||
desc: Lint the code without auto-fixing issues. | ||
cmds: | ||
- ruff check sec_parser/ | ||
- mypy | ||
|
||
lint-fix: | ||
desc: Lint the code and auto-fix issues. | ||
cmds: | ||
- ruff check --fix sec_parser/ | ||
- mypy | ||
|
||
############################ | ||
### Run End-to-end Tests ### | ||
############################ | ||
|
||
e2e: | ||
desc: Run repeated end-to-end tests. | ||
cmds: | ||
- python -m tests.e2e.sec_parser | ||
# The CLI_ARGS variable allows passing custom arguments to the end-to-end test after "--". | ||
# For instance, to run the test with specific parameters, use the command: | ||
# task e2e -- --tests-per-core=5 --cores=2 --limit_documents=2 | ||
- python -m tests.e2e.sec_parser {{.CLI_ARGS}} | ||
|
||
e2e-smoke: | ||
desc: Run a single end-to-end test per document. This is a useful way to verify if the parser is functioning (a so-called "smoke" test). | ||
desc: Run a single end-to-end test for a single document. This is a useful way to verify if the parser is functioning (a so-called "smoke" test). | ||
cmds: | ||
- python -m tests.e2e.sec_parser --tests-per-core=1 --cores=1 | ||
- python -m tests.e2e.sec_parser --tests-per-core=1 --cores=1 --limit_documents=1 | ||
|
||
e2e-watch: | ||
desc: Run repeated end-to-end tests every 10 minutes. | ||
cmds: | ||
- watch -n 600 task e2e | ||
|
||
prepare: | ||
desc: Lint the code and run all quick checks. | ||
cmds: | ||
- task unit && task lint && task e2e-smoke # Executing in this order instead of using Taskfile's `deps` to control the order of execution | ||
|
||
p: | ||
desc: Shortcut for `task prepare`. | ||
deps: | ||
- prepare | ||
####################### | ||
### Developer Tools ### | ||
####################### | ||
|
||
visual: | ||
desc: Run the parser output visualizer (used for debugging and demos). | ||
desc: Run the parser output visualizer (used for debugging and demos). This will open a browser window with the user interface. | ||
cmds: | ||
# PYTHONPATH is added to make streamlit watch file changes. Read more: https://docs.streamlit.io/knowledge-base/using-streamlit/streamlit-watch-changes-other-modules-importing-app | ||
- PYTHONPATH=$PYTHONPATH:$(pwd)/sec_parser streamlit run debug_tools/parser_output_visualizer/app.py --server.runOnSave=true |
Oops, something went wrong.