diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 00000000..077967f9 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,6 @@ +[bumpversion] +current_version = 0.0.1 +commit = True +tag = True + +[bumpversion:file:pyproject.toml] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..0e027b12 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ + + +## Description + + +## Motivation and Context + + + +## How Has This Been Tested? + +- [ ] Pass the test by running: `pytest qlib/tests/test_all_pipeline.py` under upper directory of `qlib`. +- [ ] If you are adding a new feature, test on your own test scripts. + + + +## Screenshots of Test Results (if appropriate): +1. Pipeline test: +2. Your own tests: + +## Types of changes + +- [ ] Fix bugs +- [ ] Add new feature +- [ ] Update documentation diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75e3c44a..d77ad178 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,17 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: env | sort - run: make dev - - env: - # Two environment variables here can cause sphinx to fail to build in ci. - # CHAT_MAX_TOKENS: ${{ secrets.CHAT_MAX_TOKENS }} - # CHAT_TEMPERATURE: ${{ secrets.CHAT_TEMPERATURE }} - CHAT_AZURE_API_BASE: ${{ secrets.CHAT_AZURE_API_BASE }} - CHAT_AZURE_API_VERSION: ${{ secrets.CHAT_AZURE_API_VERSION }} - CHAT_MODEL: ${{ secrets.CHAT_MODEL }} - EMBEDDING_AZURE_API_BASE: ${{ secrets.CHAT_AZURE_API_BASE }} - EMBEDDING_AZURE_API_VERSION: ${{ secrets.CHAT_AZURE_API_VERSION }} - EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} - name: lint test docs and build + - name: lint test docs and build run: make lint docs-gen # test docs build strategy: matrix: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..27adcc45 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,22 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + lint-title: + runs-on: ubuntu-latest + steps: + - name: Check PR Title for Conventional Commit Format + run: | + if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|deps|doc|docs|feat|fix|perf|ref|refactor|revert|style|test|tests)(\(\w+\))?!?:\s.*'; then + echo 'The title does not conform to the Conventional Commit.' + echo 'Please refer to "https://www.conventionalcommits.org/"' + exit 1 + fi +name: Lint pull request title +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 006e0900..00817980 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,15 @@ +name: Release +on: + push: + branches: + - main +permissions: + contents: read jobs: - package: - needs: release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - cache: pip - python-version: '3.8' - - run: env | sort - - run: make dev-package - - run: make build - - env: - TWINE_NON_INTERACTIVE: true - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - TWINE_USERNAME: ${{ vars.TWINE_USERNAME != '' && vars.TWINE_USERNAME || '__token__' }} - run: make upload - pages-build: + release: + permissions: + contents: write + pull-requests: read runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -27,65 +19,53 @@ jobs: uses: actions/setup-python@v5 with: cache: pip - python-version: '3.8' - - run: env | sort - - run: make dev-docs - - run: make docs - - name: Upload changelog - uses: actions/upload-artifact@v4 - with: - name: changelog - path: docs/changelog.md - - name: Upload pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: public - pages-deploy: - needs: release - permissions: - id-token: write - pages: write - runs-on: ubuntu-latest - steps: - - id: deployment - name: Deploy to GitHub Pages - uses: actions/deploy-pages@v4 - release: - needs: pages-build - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install git-changelog using pipx - run: pipx install git-changelog - - name: Remove changelog to avoid file already exists error - run: rm -v docs/changelog.md - - name: Download changelog - uses: actions/download-artifact@v4 - with: - name: changelog - path: docs/ + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine bump2version git-changelog # better-exceptions(optional for debug) + - name: Bump version + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + bump2version patch + NEW_VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml) + echo "new_version=$NEW_VERSION" >> $GITHUB_ENV + echo "New version: $NEW_VERSION" + - name: Push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push --follow-tags + - name: Generate changelog + run: | + make changelog - name: Prepare release notes run: make release-notes > release-notes.md - - id: prerelease - name: Determine prerelease - run: | - if [[ "${{ github.ref }}" =~ (a|b|rc)(0|[1-9][0-9]*)?$ ]]; then - echo "is_prerelease=true" > $GITHUB_OUTPUT - else - echo "is_prerelease=false" > $GITHUB_OUTPUT - fi - name: Create GitHub release uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + tag_name: ${{ env.new_version }} + release_name: Release ${{ env.new_version }} body_path: release-notes.md - prerelease: ${{ steps.prerelease.outputs.is_prerelease }} -name: Release -on: - push: - tags: - - v?[0-9]+.[0-9]+.[0-9]+ - - v?[0-9]+.[0-9]+.[0-9]+-?a[0-9]* - - v?[0-9]+.[0-9]+.[0-9]+-?b[0-9]* - - v?[0-9]+.[0-9]+.[0-9]+-?rc[0-9]* + prerelease: false + # package: + # needs: release + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python + # uses: actions/setup-python@v5 + # with: + # cache: pip + # python-version: '3.10' + # - run: env | sort + # - run: make dev + # - run: make build + # - env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + # run: | + # make upload diff --git a/Makefile b/Makefile index b3618567..f029a36c 100644 --- a/Makefile +++ b/Makefile @@ -169,13 +169,19 @@ docs-autobuild: --watch rdagent # Generate changelog from git commits. +# The -c and -s arguments should match +# If -c uses Basic (default, inherits from base class), -s optional argument: # If -c uses conventional (inherits from base class), -s optional parameter: add,fix,change,remove,merge,doc +# If -c uses conventional (inherits from base class), -s is optional: build,chore,ci,deps,doc,docs,feat,fix,perf,ref,refactor,revert,style,test,tests +# If -c uses angular (inherits from conventional), -s optional argument: build,chore,ci,deps,doc,docs,feat,fix,perf,ref,refactor,revert,style,test,tests # NOTE(xuan.hu): Need to be run before document generation to take effect. +# $(PIPRUN) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test changelog: @if wget -q --spider $(CHANGELOG_URL); then \ echo "Existing Changelog found at '$(CHANGELOG_URL)', download for incremental generation."; \ wget -q -O $(CHANGELOG_PATH) $(CHANGELOG_URL); \ fi - $(PIPRUN) git-changelog -ETrio $(CHANGELOG_PATH) -c conventional -s build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test + $(PIPRUN) LATEST_TAG=$$(git tag --sort=-creatordate | head -n 1); \ + git-changelog --bump $$LATEST_TAG -Tio docs/changelog.md -c conventional -s build,chore,ci,deps,doc,docs,feat,fix,perf,ref,refactor,revert,style,test,tests # Generate release notes from changelog. release-notes: diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 00000000..9e692ab4 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,4 @@ +# Changelog + +## [Unreleased] + diff --git a/pyproject.toml b/pyproject.toml index 209ad958..60ddb073 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ requires = [ "setuptools", "setuptools-scm", ] -root = "rdagent" [project] authors = [ @@ -16,23 +15,22 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", ] description = "Research & Development Agent" dynamic = [ "dependencies", "optional-dependencies", - "version", ] keywords = [ "Autonomous Agents", "Large Language Models", "Research and Development", ] +license = {text = "MIT License"} name = "rdagent" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.10" +version = "v0.0.1" [project.urls] homepage = "https://github.com/microsoft/RD-Agent/"