From b29449e7ae2b2f33ff016c65cacf3b77914ddf74 Mon Sep 17 00:00:00 2001 From: Weirui Kuang <39145382+rayrayraykk@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:16:26 +0800 Subject: [PATCH] [maintenance] Enhancements to Code Formatting, and Testing Workflowadd workflow (#2) * add workflow * pending for dics --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/custom.md | 10 ++++++ .github/release-drafter.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/pre-commit.yml | 17 +++++++--- .github/workflows/unittest.yml | 32 +++++++++++++++++++ 5 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/custom.md create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c4e22c0a4..f58ea8979 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,4 +28,4 @@ Detailed error messages. - OS: [e.g. macos, windows] **Additional context** -Add any other context about the problem here. +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 000000000..48d5f81fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,10 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..e4079133a --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,48 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - 'Feature' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - 'hotfix' + - title: '🧰 Maintenance' + labels: + - 'chore' + - 'maintenance' + - 'refactor' + - 'style' + - 'docs' +exclude-labels: + - 'skip-changelog' + - 'duplicate' + - 'question' + - 'invalid' + - 'wontfix' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## What's Changed + + $CHANGES + + ## Contributors + Thanks to all the contributors who have helped with this release! + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index aad4a946f..c25591764 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -name: Pre-commit (Required) +name: Pre-commit on: [push, pull_request] @@ -18,11 +18,18 @@ jobs: uses: actions/setup-python@master with: python-version: 3.9 - - name: Install dependencies + - name: Install AgentScope + run: | + pip install -q -e .[full] + - name: Install pre-commit run: | - pip install pre-commit pre-commit install - name: Pre-commit starts run: | - pre-commit run --all-files - [ $? -eq 1 ] && exit 1 || echo "Passed" + pre-commit run --all-files > pre-commit.log 2>&1 || true + cat pre-commit.log + if grep -q Failed pre-commit.log; then + echo -e "\e[41m [**FAIL**] Please install pre-commit and format your code first. \e[0m" + exit 1 + fi + echo -e "\e[46m ********************************Passed******************************** \e[0m" diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 000000000..9a4d5c561 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,32 @@ +name: Python Unittest Coverage + +on: [push, pull_request] + +jobs: + test: + if: false == contains(github.event.pull_request.title, 'WIP') + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ['3.9'] + env: + OS: ${{ matrix.os }} + PYTHON: '3.9' + timeout-minutes: 20 + steps: + - uses: actions/checkout@master + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@master + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + pip install -q -e .[full] + pip install coverage + - name: Run tests with coverage + run: | + coverage run tests/run.py + - name: Generate coverage report + run: | + coverage report -m