-
Notifications
You must be signed in to change notification settings - Fork 54
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
199 changed files
with
3,219 additions
and
308 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,60 @@ | ||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
path: | ||
- "python/**" | ||
- "docs/**" | ||
- "README.md" | ||
workflow_dispatch: | ||
|
||
name: Docs | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./python | ||
|
||
env: | ||
RUFF_OUTPUT_FORMAT: github | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- 'ubuntu-latest' | ||
python-version: | ||
- '3.11' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
- name: Install Poetry | ||
run: | | ||
pip install poetry | ||
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | ||
poetry lock | ||
- name: Get Poetry version | ||
run: poetry --version | ||
- name: Setup Python Cache | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
cache: "poetry" | ||
- name: Install deps | ||
run: | | ||
make install | ||
- name: Build docs | ||
run: make doc | ||
- name: Prepare artifact | ||
run: tar czvf /tmp/docs.tar.gz ./output/docs/_build | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: docs | ||
path: /tmp/docs.tar.gz |
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,52 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Release docs | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: [Go Release, Python Release] | ||
types: | ||
- completed | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
docs: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Install | ||
run: | | ||
pip3 install poetry | ||
make install | ||
- name: Build docs | ||
run: | | ||
make doc | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: './output/docs/_build/html' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
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,66 @@ | ||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
paths: | ||
- "go/**" | ||
- "python/qianfan/tests/utils/mock_server.py" | ||
workflow_dispatch: | ||
|
||
name: Go CI | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
name: Unit tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- 'ubuntu-latest' | ||
- 'macos-latest' | ||
- 'windows-latest' | ||
go-version: [ '1.19', '1.20', '1.21.x' ] | ||
python-version: [ '3.11' ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
- name: Install Poetry | ||
run: | | ||
pip install poetry | ||
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | ||
cd python && poetry lock | ||
- name: Setup Python Cache | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
cache: "poetry" | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache-dependency-path: go/qianfan/go.mod | ||
- name: Display version | ||
run: | | ||
go version | ||
python --version | ||
poetry --version | ||
- name: Install deps | ||
run: | | ||
make install | ||
- name: Run test | ||
run: | | ||
make mock | ||
make -C go test | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
working-directory: go/qianfan |
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,78 @@ | ||
name: Go Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
name: Release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- 'ubuntu-latest' | ||
go-version: [ '1.21.x' ] | ||
python-version: [ '3.11' ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
- name: Display version | ||
run: | | ||
go version | ||
python --version | ||
- name: Install latest version of Poetry | ||
if: steps.cache-poetry.outputs.cache-hit != 'true' | ||
run: | | ||
pip install poetry | ||
- name: Add Poetry to $PATH | ||
run: | | ||
echo "$HOME/.poetry/bin" >> $GITHUB_PATH | ||
- name: Get Poetry version | ||
run: poetry --version | ||
- name: Install deps | ||
if: steps.cache-deps.cache-hit != 'true' | ||
run: | | ||
make install | ||
- name: Run test | ||
run: | | ||
make mock | ||
make -C go test | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
working-directory: go/qianfan | ||
- name: Check version | ||
id: check-version | ||
run: | | ||
VERSION=$(cat go/qianfan/version.go|grep 'const Version ='|sed -r "s/.*\"v(.*)\"/\1/g") | ||
echo $VERSION | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: ${{ format('Go v{0}', steps.check-version.outputs.version) }} | ||
token: ${{ secrets.QF_GITHUB_TOKEN }} | ||
draft: false | ||
generateReleaseNotes: true | ||
tag: ${{ format('go/qianfan/v{0}', steps.check-version.outputs.version) }} | ||
prerelease: ${{ contains(steps.check-version.outputs.version, 'rc') }} | ||
commit: main | ||
- name: Update Go module index | ||
env: | ||
GOPROXY: proxy.golang.org | ||
VERSION: ${{ steps.check-version.outputs.version }} | ||
run: | | ||
go list -m github.com/baidubce/bce-qianfan-sdk/go/qianfan@v$VERSION |
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
Oops, something went wrong.