ci: change ci yml (#146)

* change ci yml

* add PULL_REQUEST_TEMPLATE

* change ci yml

* change ci yml

* Update .github/workflows/release.yml

* Update .github/workflows/release.yml

* Update .github/workflows/release.yml

---------

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
This commit is contained in:
Linlang
2024-08-02 12:57:34 +08:00
committed by GitHub
parent 3fb316bfbc
commit 8a07dd6df6
8 changed files with 123 additions and 92 deletions
+25
View File
@@ -0,0 +1,25 @@
<!--- Thank you for submitting a Pull Request! In order to make our work smoother, please make sure your Pull Request meets the following requirements: 1. Provide a general summary of your changes in the Title above; 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `deps:`, `doc`, `docs`, `feat`, `fix`, `perf`, `ref`, `refactor`, `revert`, `style`, `test`, `tests`. -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Are there any related issues? If so, please put the link here. -->
<!--- Why is this change required? What problem does it solve? -->
## How Has This Been Tested?
<!--- Put an `x` in all the boxes that apply: --->
- [ ] 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.
<!--- **ATTENTION**: If you are adding a new feature, please make sure your codes are **correctly tested**. If our test scripts do not cover your cases, please provide your own test scripts under the `tests` folder and test them. More information about test scripts can be found [here](https://docs.python.org/3/library/unittest.html#basic-example), or you could refer to those we provide under the `tests` folder. -->
## Screenshots of Test Results (if appropriate):
1. Pipeline test:
2. Your own tests:
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Fix bugs
- [ ] Add new feature
- [ ] Update documentation
+1 -11
View File
@@ -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:
+22
View File
@@ -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
+55 -75
View File
@@ -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