-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add release and publish actions
- Loading branch information
Showing
3 changed files
with
102 additions
and
27 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,72 @@ | ||
name: Release and Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write # Required for creating releases | ||
id-token: write # Required for PyPI trusted publishing | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const script = require('./.github/workflows/scripts/create_release.js') | ||
await script(github, context, core) | ||
env: | ||
RELEASE_TAG: ${{ github.ref_name }} | ||
|
||
build-n-publish: | ||
needs: create-release | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/tracestorm | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
cache: 'pip' | ||
|
||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine build | ||
- name: Build source and wheel distributions | ||
run: | | ||
python -m build | ||
twine check dist/* | ||
- name: Upload Release Assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./dist/*.whl | ||
asset_name: tracestorm-${{ github.ref_name }}.whl | ||
asset_content_type: application/x-wheel+zip | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: dist/ | ||
verbose: true | ||
print-hash: true |
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,17 @@ | ||
// Uses Github's API to create the release and wait for result | ||
module.exports = async (github, context, core) => { | ||
try { | ||
const response = await github.rest.repos.createRelease({ | ||
draft: false, | ||
generate_release_notes: true, | ||
name: process.env.RELEASE_TAG, | ||
owner: context.repo.owner, | ||
prerelease: false, | ||
repo: context.repo.repo, | ||
tag_name: process.env.RELEASE_TAG, | ||
}); | ||
core.setOutput('upload_url', response.data.upload_url); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,10 +4,11 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "tracestorm" | ||
version = "0.0.2" | ||
description = "A replay tool for LLM requests" | ||
version = "0.0.3" | ||
description = "A tool for generating and replaying traces of requests to OpenAI API endpoints" | ||
readme = "README.md" | ||
authors = [ | ||
{name="Yao Fu", email="[email protected]"} | ||
{name = "Yao Fu", email = "[email protected]"} | ||
] | ||
|
||
dependencies = [ | ||
|
@@ -18,6 +19,7 @@ dependencies = [ | |
"matplotlib>=3.10", | ||
"click>=8.1.8" | ||
] | ||
requires-python = ">=3.9" | ||
|
||
[project.scripts] | ||
tracestorm = "tracestorm.cli:main" | ||
|
@@ -29,32 +31,16 @@ exclude = [] | |
[tool.ruff.lint] | ||
fixable = ["ALL"] | ||
unfixable = [ | ||
# star imports | ||
"F405", | ||
"F403", | ||
# lambda expression assignment | ||
"E731", | ||
# Loop control variable not used within loop body | ||
"B007", | ||
# raise distinguish errors | ||
"B904", | ||
# f-string format | ||
"F405", # star imports | ||
"F403", # lambda expression assignment | ||
"E731", # Loop control variable not used within loop body | ||
"B007", # raise distinguish errors | ||
"B904", # f-string format | ||
"UP032", | ||
] | ||
select = [ | ||
# isort | ||
"I", | ||
] | ||
ignore = [ | ||
# Loop control variable not used within loop body | ||
"B007" | ||
] | ||
|
||
select = ["I"] # isort | ||
ignore = ["B007"] # Loop control variable not used within loop body | ||
|
||
[tool.isort] | ||
use_parentheses = true | ||
skip_gitignore = true | ||
|
||
[tool.codespell] | ||
skip = 'build,*.egg-info,images' | ||
quiet-level = 1 | ||
skip_gitignore = true |