-
Notifications
You must be signed in to change notification settings - Fork 0
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
20 changed files
with
941 additions
and
32 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,146 @@ | ||
name: Release lib | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
PYPI_API_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
|
||
source: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Modify the setup files | ||
run: | | ||
rm -rf src/tensorneko_util | ||
rm -rf src/tensorneko | ||
rm -rf test | ||
rm -rf .github | ||
rm requirements.txt requirements_util.txt requirements_test.txt pypi.sh init.py .gitignore | ||
rm setup.py | ||
rm setup_util.py | ||
mv pyproject_lib.toml pyproject.toml | ||
new_version=$(cat version.txt) && sed -i "/^\[package\]$/,/^\[/ s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml | ||
rm version.txt | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
command: sdist | ||
args: -o dist | ||
rust-toolchain: nightly | ||
- name: Upload dist | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tensorneko-lib | ||
path: dist | ||
|
||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: [x86_64, aarch64, armv7, s390x, ppc64le] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Modify the setup files | ||
run: | | ||
rm -rf src/tensorneko_util | ||
rm -rf src/tensorneko | ||
rm setup.py | ||
rm setup_util.py | ||
mv pyproject_lib.toml pyproject.toml | ||
new_version=$(cat version.txt) && sed -i "/^\[package\]$/,/^\[/ s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
manylinux: auto | ||
command: build | ||
rust-toolchain: nightly | ||
target: ${{ matrix.target }} | ||
args: --release -o dist -i 3.7 3.8 3.9 3.10 3.11 pypy3.8 pypy3.9 | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tensorneko-lib | ||
path: dist | ||
|
||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Modify the setup files | ||
run: | | ||
Remove-Item src/tensorneko_util -Recurse -Force | ||
Remove-Item src/tensorneko -Recurse -Force | ||
Remove-Item setup.py -Force | ||
Remove-Item setup_util.py -Force | ||
Move-Item pyproject_lib.toml pyproject.toml | ||
$new_version = Get-Content version.txt -Raw | ||
$in_package_section = $false | ||
(Get-Content Cargo.toml -Raw) -split "`r`n" | ForEach-Object { | ||
if ($_ -match '^\[package\]$') { | ||
$in_package_section = $true | ||
} | ||
if ($_ -match '^\[.*\]$' -and $_ -notmatch '^\[package\]$') { | ||
$in_package_section = $false | ||
} | ||
if ($in_package_section -and $_ -match '^version = "') { | ||
$_ -replace 'version = "[0-9]*\.[0-9]*\.[0-9]*"', "version = `"$new_version`"" | ||
} else { | ||
$_ | ||
} | ||
} | Set-Content Cargo.toml | ||
shell: powershell | ||
|
||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
command: build | ||
target: x64 | ||
args: --release -o dist -i 3.7 3.8 3.9 3.10 3.11 | ||
rust-toolchain: nightly | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tensorneko-lib | ||
path: dist | ||
|
||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Modify the setup files | ||
run: | | ||
rm -rf src/tensorneko_util | ||
rm -rf src/tensorneko | ||
rm setup.py | ||
rm setup_util.py | ||
mv pyproject_lib.toml pyproject.toml | ||
new_version=$(cat version.txt) && sed -i '' "/^\[package\]$/,/^\[/ s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml | ||
- uses: PyO3/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --release -o dist --sdist -i 3.7 3.8 3.9 3.10 3.11 pypy3.8 pypy3.9 | ||
target: universal2-apple-darwin | ||
rust-toolchain: nightly | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tensorneko-lib | ||
path: dist | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [ macos, windows, linux, source ] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: tensorneko-lib | ||
- name: Publish to PyPI | ||
uses: messense/maturin-action@v1 | ||
env: | ||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
with: | ||
command: upload | ||
args: --skip-existing * |
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.