Skip to content

Commit 2d05a70

Browse files
authored
ci: auto release (#1985)
* ci: auto release * fix: bug getting version in qlib/__init__.py * fix: bug getting version in setup.py * fix: bug getting version in qlib/__init__.py * fix: make the code in CI more complete * fix: specify the root directory in the get_verison method * fix: parameter error * update: optimize code && add comments
1 parent da920b7 commit 2d05a70

15 files changed

+206
-141
lines changed

.commitlintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
// Configuration Format: [level, applicability, value]
5+
// level: Error level, usually expressed as a number:
6+
// 0 - disable rule
7+
// 1 - Warning (does not prevent commits)
8+
// 2 - Error (will block the commit)
9+
// applicability: the conditions under which the rule applies, commonly used values:
10+
// “always” - always apply the rule
11+
// “never” - never apply the rule
12+
// value: the specific value of the rule, e.g. a maximum length of 100.
13+
// Refs: https://commitlint.js.org/reference/rules-configuration.html
14+
"header-max-length": [2, "always", 100],
15+
"type-enum": [
16+
2,
17+
"always",
18+
["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "Release-As"]
19+
]
20+
}
21+
};

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<!--- Thank you for submitting a Pull Request! In order to make our work smoother. -->
2+
<!--- please make sure your Pull Request meets the following requirements: -->
3+
<!--- 1. Provide a general summary of your changes in the Title above; -->
4+
<!--- 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `docs:`, `feat:`, `fix:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`(Ref: https://www.conventionalcommits.org/). -->
5+
<!--- Category: -->
6+
<!--- Patch Updates: `fix:` -->
7+
<!--- Example: fix(auth): correct login validation issue -->
8+
<!--- minor update (introduces new functionality): `feat` -->
9+
<!--- Example: feature(parser): add ability to parse arrays -->
10+
<!--- major update(destructive update): Include BREAKING CHANGE in the commit message footer, or add `! ` in the commit footer to indicate that there is a destructive update. -->
11+
<!--- Example: feat(auth)! : remove support for old authentication method -->
12+
<!--- Other updates: `build:`, `chore:`, `ci:`, `docs:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`. -->
13+
114
<!--- Provide a general summary of your changes in the Title above -->
215

316
## Description

.github/labeler.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/labeler.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/lint_title.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lint pull request title
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- edited
10+
11+
concurrency:
12+
cancel-in-progress: true
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
15+
jobs:
16+
lint-title:
17+
runs-on: ubuntu-latest
18+
steps:
19+
# This step is necessary because the lint title uses the .commitlintrc.js file in the project root directory.
20+
- name: Checkout Repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '16'
27+
28+
- name: Install commitlint
29+
run: npm install --save-dev @commitlint/{config-conventional,cli}
30+
31+
- name: Validate PR Title with commitlint
32+
env:
33+
BODY: ${{ github.event.pull_request.title }}
34+
run: |
35+
echo "$BODY" | npx commitlint --config .commitlintrc.js

.github/workflows/python-publish.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
release_created: ${{ steps.release_please.outputs.release_created }}
16+
17+
steps:
18+
- name: Release please
19+
id: release_please
20+
uses: googleapis/release-please-action@v4
21+
with:
22+
token: ${{ secrets.PAT }}
23+
release-type: simple
24+
25+
deploy_with_manylinux:
26+
needs: release
27+
permissions:
28+
contents: write
29+
pull-requests: read
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
if: needs.release.outputs.release_created == 'true'
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
if: needs.release.outputs.release_created == 'true'
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
44+
- name: Build wheel on Linux
45+
if: needs.release.outputs.release_created == 'true'
46+
uses: RalfG/[email protected]_x86_64
47+
with:
48+
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312'
49+
build-requirements: 'numpy cython'
50+
51+
- name: Install dependencies
52+
if: needs.release.outputs.release_created == 'true'
53+
run: |
54+
python -m pip install twine
55+
56+
- name: Upload to PyPi
57+
if: needs.release.outputs.release_created == 'true'
58+
env:
59+
TWINE_USERNAME: __token__
60+
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}
61+
run: |
62+
twine check dist/pyqlib-*-manylinux*.whl
63+
twine upload --repository-url https://test.pypi.org/legacy/ dist/pyqlib-*-manylinux*.whl --verbose
64+
65+
deploy_with_bdist_wheel:
66+
needs: release
67+
runs-on: ${{ matrix.os }}
68+
strategy:
69+
matrix:
70+
# After testing, the whl files of pyqlib built by macos-14 and macos-15 in python environments of 3.8, 3.9, 3.10, 3.11, 3.12,
71+
# the filenames are exactly duplicated, which will result in the duplicated whl files not being able to be uploaded to pypi,
72+
# so we chose to just keep the latest macos-latest. macos-latest currently points to macos-15.
73+
# Also, macos-13 will stop being supported on 2025-11-14.
74+
# Refs: https://github.blog/changelog/2025-07-11-upcoming-changes-to-macos-hosted-runners-macos-latest-migration-and-xcode-support-policy-updates/
75+
os: [windows-latest, macos-latest]
76+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
if: needs.release.outputs.release_created == 'true'
81+
with:
82+
fetch-depth: 0
83+
84+
- name: Set up Python ${{ matrix.python-version }}
85+
if: needs.release.outputs.release_created == 'true'
86+
uses: actions/setup-python@v4
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
90+
- name: Install dependencies
91+
if: needs.release.outputs.release_created == 'true'
92+
run: |
93+
make dev
94+
95+
- name: Build wheel on ${{ matrix.os }}
96+
if: needs.release.outputs.release_created == 'true'
97+
run: |
98+
make build
99+
100+
- name: Upload to PyPi
101+
if: needs.release.outputs.release_created == 'true'
102+
env:
103+
TWINE_USERNAME: __token__
104+
TWINE_PASSWORD: ${{ secrets.TESTPYPI }}
105+
run: |
106+
twine check dist/*.whl
107+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*.whl --verbose

.github/workflows/test_qlib_from_pip.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121

2222
steps:
2323
- name: Test qlib from pip
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2527

2628
- name: Set up Python ${{ matrix.python-version }}
2729
uses: actions/setup-python@v4
@@ -32,19 +34,9 @@ jobs:
3234
run: |
3335
python -m pip install --upgrade pip
3436
35-
# Will cancel this step when the next qlib version is released. The current qlib version is: 0.9.6
36-
- name: Installing pywinpt for windows
37-
if: ${{ matrix.os == 'windows-latest' }}
38-
run: |
39-
python -m pip install pywinpty --only-binary=:all:
40-
41-
# # joblib was released on 2025-05-04 with version 1.5.0, in which _backend_args was removed and replaced by _backend_kwargs.
42-
# This change caused the application to fail, so the version of joblib is restricted here.
43-
# This restriction will be removed in the next release. The current qlib version is: 0.9.6
4437
- name: Qlib installation test
4538
run: |
4639
python -m pip install pyqlib
47-
python -m pip install "joblib<=1.4.2"
4840
4941
- name: Install Lightgbm for MacOS
5042
if: ${{ matrix.os == 'macos-14' || matrix.os == 'macos-15' }}
@@ -53,12 +45,10 @@ jobs:
5345
brew install libomp || brew reinstall libomp
5446
python -m pip install --no-binary=:all: lightgbm
5547
56-
# When the new version is released it should be changed to:
57-
# python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
5848
- name: Downloads dependencies data
5949
run: |
6050
cd ..
61-
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
51+
python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
6252
cd qlib
6353
6454
- name: Test workflow by config

.github/workflows/test_qlib_from_source.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222

2323
steps:
2424
- name: Test qlib from source
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
2628

2729
- name: Set up Python ${{ matrix.python-version }}
2830
uses: actions/setup-python@v4

0 commit comments

Comments
 (0)