diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 221da2d..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI - -on: push - -jobs: - build: - name: Build distribution 📦 - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, macos-latest] - python-version: [3.9, 3.10.8, 3.11] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install pypa/build - run: >- - python3 -m pip install build Cython numpy setuptools wheel --user - - name: Build a binary wheel and a source tarball - run: python3 -m build -n - - name: Store the distribution packages - uses: actions/upload-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - publish-to-pypi: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: release - url: https://pypi.org/project/ms-anomaly-detector # Replace with your PyPI project name - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - github-release: - name: >- - Sign the Python 🐍 distribution 📦 with Sigstore - and upload them to GitHub Release - needs: - - publish-to-pypi - runs-on: ubuntu-latest - - permissions: - contents: write # IMPORTANT: mandatory for making GitHub Releases - id-token: write # IMPORTANT: mandatory for sigstore - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v1.2.3 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - run: >- - gh release create - '${{ github.ref_name }}' - --repo '${{ github.repository }}' - --notes "" - - name: Upload artifact signatures to GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - # Upload to GitHub Release using the `gh` CLI. - # `dist/` contains the built packages, and the - # sigstore-produced signatures and certificates. - run: >- - gh release upload - '${{ github.ref_name }}' dist/** - --repo '${{ github.repository }}' - - publish-to-testpypi: - name: Publish Python 🐍 distribution 📦 to TestPyPI - needs: - - build - runs-on: ubuntu-latest - - environment: - name: test-release - url: https://test.pypi.org/project/ms-anomaly-detector - - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..06e64cd --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,68 @@ +name: Build and Release +on: + push: + tags: + - 'v*' + workflow_dispatch: + inputs: + branch: + description: 'Name of the branch to build and release' + required: true + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + python-version: ['3.9', '3.10.8', '3.11'] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine cython numpy + + - name: Build a binary wheel and a source tarball + run: | + python setup.py bdist_wheel sdist + + - name: Rename wheel for manylinux compatibility (Ubuntu only) + if: runner.os == 'Linux' + run: | + for file in *.whl; do + if [[ $file == *linux* ]]; then + mv "$file" "${file/-linux/-manylinux1}" + fi + done + + - name: Publish artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/ + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: dist + path: dist/ + + - name: Publish to GitHub Releases + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: v${{ github.ref }} + title: Release ${{ github.ref }} + body: ${{ github.event.pull_request.body }} diff --git a/.gitignore b/.gitignore index 438760f..c1edabe 100644 --- a/.gitignore +++ b/.gitignore @@ -404,10 +404,9 @@ venv/ dist/ temp/ build/ -anomaly_detector.egg-info/ +time_series_anomaly_detector.egg-info/ anomaly-detector/anomaly_detector/univariate/_anomaly_kernel_cython.c - .idea/ *.so - +*.pyd .script\Dockerfile \ No newline at end of file diff --git a/README.md b/README.md index d443fa9..e2749cf 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ Tested on ## Installing from pip ```bash +# install dependencies +pip install numpy>=1.23.5 Cython + +# then install time-series-anomaly-detector pip install time-series-anomaly-detector ```