-
Notifications
You must be signed in to change notification settings - Fork 52
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
46 changed files
with
338 additions
and
4,800 deletions.
There are no files selected for viewing
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,32 @@ | ||
name: Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Lint: | ||
name: Lint | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: checkout develop | ||
run: | | ||
if ! git show-ref --quiet refs/heads/develop; then \ | ||
echo "local develop branch is missing, creating local develop branch that tracks remote develop branch" | ||
git fetch origin develop | ||
git branch develop --track origin/develop | ||
else | ||
echo "local develop branch exist, skipping" | ||
fi | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
cache: 'pip' # caching pip dependencies | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
make install | ||
- name: run the command | ||
run: make lint | ||
|
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,41 @@ | ||
name: Release | ||
|
||
jobs: | ||
Release: | ||
name: Release | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Should Deploy | ||
id: should-deploy | ||
run: python scripts/should_deploy.py >> $GITHUB_OUTPUT | ||
|
||
- name: Check Branch | ||
id: check-branch | ||
run: | | ||
if [[ ${{ github.ref }} =~ ^refs/heads/(agent)$ ]]; then | ||
echo "match=true" >> $GITHUB_OUTPUT | ||
fi # See: https://stackoverflow.com/a/58869470/1123955 | ||
- name: Is A Publish Branch | ||
if: steps.check-branch.outputs.match == 'true' && steps.should-deploy.outputs.should_deploy == 'true' | ||
env: | ||
TWINE_USERNAME: paddle-dev | ||
TWINE_PASSWORD: ${{ secrets.paddlenlp }} | ||
run: | | ||
make deploy | ||
- name: Should Not Deploy To Pypi Server | ||
if: steps.should-deploy.outputs.should_deploy != 'true' | ||
run: echo 'should not deploy pypi server' | ||
|
||
- name: Is Not A Publish Branch | ||
if: steps.check-branch.outputs.match != 'true' | ||
run: echo 'Not A Publish Branch' |
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,27 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Test: | ||
name: Test | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
cache: 'pip' # caching pip dependencies | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r tests/requirements.txt | ||
make install | ||
- name: run the command | ||
run: make test | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Makefile for ErnieBot Agent | ||
# | ||
# GitHb: https://github.com/PaddlePaddle/Ernie-Bot-Agent | ||
# Author: Paddle Team https://github.com/PaddlePaddle | ||
# | ||
|
||
.PHONY: all | ||
all : lint test | ||
# # # # # # # # # # # # # # # Format Block # # # # # # # # # # # # # # # | ||
|
||
format: | ||
pre-commit run isort | ||
pre-commit run black | ||
|
||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | ||
|
||
# # # # # # # # # # # # # # # Lint Block # # # # # # # # # # # # # # # | ||
|
||
.PHONY: lint | ||
lint: | ||
$(eval modified_py_files := $(shell python scripts/get_modified_files.py $(check_dirs))) | ||
@if test -n "$(modified_py_files)"; then \ | ||
echo ${modified_py_files}; \ | ||
pre-commit run --files ${modified_py_files}; \ | ||
else \ | ||
echo "No library .py files were modified"; \ | ||
fi | ||
|
||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | ||
|
||
# # # # # # # # # # # # # # # Test Block # # # # # # # # # # # # # # # | ||
|
||
.PHONY: test | ||
test: unit-test | ||
|
||
unit-test: | ||
PYTHONPATH=$(shell pwd) pytest -v \ | ||
-n auto \ | ||
--durations 20 \ | ||
--cov erniebot_agent \ | ||
--cov-report xml:coverage.xml | ||
|
||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | ||
|
||
.PHONY: install | ||
install: | ||
pip install -r requirements-dev.txt | ||
pip install -r requirements.txt | ||
pre-commit install | ||
|
||
|
||
.PHONY: deploy | ||
deploy: | ||
# install related package | ||
make install | ||
# build | ||
python3 setup.py sdist bdist_wheel | ||
# upload | ||
twine upload --skip-existing dist/* |
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 @@ | ||
0.0.1 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.