diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4f96631 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/target +/dist diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml new file mode 100644 index 0000000..2d034b6 --- /dev/null +++ b/.github/workflows/release-pypi.yml @@ -0,0 +1,93 @@ +# Copyright 2025 ScopeDB, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release PyPI + +on: + push: + tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ] + pull_request: + # Manually trigger the workflow for pull requests: 1 (EDIT TO TRIGGER) + paths: [ '.github/workflows/release-pypi.yml' ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + sdist: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + - uses: PyO3/maturin-action@v1 + with: + command: sdist + args: -o dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + wheels: + runs-on: "${{ matrix.os }}" + strategy: + matrix: + include: + - { os: windows-2022 } + - { os: macos-15-intel, target: "x86_64-apple-darwin" } + - { os: macos-15, target: "aarch64-apple-darwin" } + - { os: ubuntu-24.04, target: "x86_64" } + - { os: ubuntu-24.04, target: "x86_64-unknown-linux-musl" } + - { os: ubuntu-24.04-arm, target: "aarch64" } + - { os: ubuntu-24.04-arm, target: "aarch64-unknown-linux-musl" } + - { os: ubuntu-24.04-arm, target: "armv7-unknown-linux-musleabihf" } + steps: + - uses: actions/checkout@v6 + - uses: Swatinem/rust-cache@v2 + - uses: PyO3/maturin-action@v1 + with: + target: "${{ matrix.target }}" + command: build + args: --profile dist -o dist + sccache: true + manylinux: auto + + - name: Upload wheels + uses: actions/upload-artifact@v6 + with: + name: wheels-${{ matrix.os }}-${{ matrix.target }} + path: dist + + release: + name: Release + runs-on: ubuntu-24.04 + environment: + name: release + permissions: + contents: read + id-token: write + needs: [sdist, wheels] + steps: + - uses: actions/download-artifact@v7 + with: + pattern: wheels-* + merge-multiple: true + path: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: ${{ github.repository == 'scopedb/scopeql' && github.event_name != 'pull_request' }} + with: + skip-existing: true + packages-dir: dist diff --git a/.gitignore b/.gitignore index ea8c4bf..4f96631 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/dist diff --git a/scopeql/CHANGELOG.md b/CHANGELOG.md similarity index 100% rename from scopeql/CHANGELOG.md rename to CHANGELOG.md diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c7698ec --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +# Copyright 2025 ScopeDB, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[build-system] +requires = ["maturin>=1.5,<2.0"] +build-backend = "maturin" + +[project] +name = "scopeql" +version = "0.3.1" +requires-python = ">=3.10" +description = "A command-line interface for ScopeDB" +authors = [{ name = "ScopeDB Inc.", email = "tison@scopedb.io" }] +classifiers = [ + "Environment :: Console", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Rust", +] +license = { file = "LICENSE" } +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/scopedb/scopeql" +Repository = "https://github.com/scopedb/scopeql" +Changelog = "https://github.com/scopedb/scopeql/blob/main/CHANGELOG.md" + +[tool.maturin] +bindings = "bin" +manifest-path = "scopeql/Cargo.toml" +module-name = "scopeql" +strip = true diff --git a/taplo.toml b/taplo.toml index 98a86d9..d327209 100644 --- a/taplo.toml +++ b/taplo.toml @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +exclude = ["pyproject.toml"] include = ["Cargo.toml", "**/*.toml"] [formatting]