From 421e2a3e5bc1f2bc397dfd77b1ab5a8f30b377e4 Mon Sep 17 00:00:00 2001 From: mjvakili Date: Mon, 8 Sep 2025 15:43:01 +0200 Subject: [PATCH] release pipeline --- .github/workflows/release.yml | 68 +++++++++++++++++++++++++++++++++++ docs/examples/examples.ipynb | 7 ++-- 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..26297e0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: release workflow with tests + +on: + push: + tags: + - 'v*' + release: + types: + - published +jobs: + tests: + name: "py${{ matrix.python-version }} / ${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12", "3.13"] + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Clone the repository + uses: actions/checkout@v4 + - name: Install dependencies + shell: bash {0} + run: | + if [ "${{ matrix.os }}" = "windows-latest" ]; then + powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" + export PATH="/c/Users/runneradmin/.local/bin:$PATH" + else + curl -LsSf https://astral.sh/uv/install.sh | sh + fi + uv python install ${{ matrix.python-version }} + uv venv --python ${{ matrix.python-version }} + if [ "${{ matrix.os }}" = "windows-latest" ]; then + .venv\\Scripts\\activate + else + source .venv/bin/activate + fi + uv pip install -e .[tests] + - name: Test with pytest + shell: bash {0} + run: | + uv run pytest --cov=skpcp --cov-branch --cov-report=term-missing --cov-report=xml:coverage.xml -vv test + + + # build wheel and deploy to pypi + deploy: + # Needs tests to be run successfully before deploying + needs: [tests] + runs-on: ubuntu-latest + # Run only if there is a published release + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/checkout@v4 + - name: Install project dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv python install 3.11 + uv venv --python 3.11 + source .venv/bin/activate + uv pip install -e . + - name: Build package + run: | + uv build + - name: Publish package + env: + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + run: | + uv publish --token $PYPI_API_TOKEN \ No newline at end of file diff --git a/docs/examples/examples.ipynb b/docs/examples/examples.ipynb index ac68524..e338a1c 100644 --- a/docs/examples/examples.ipynb +++ b/docs/examples/examples.ipynb @@ -25,7 +25,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Example 1" + "## Example 1: Recovery of low-rank image corrupted by sparse noise" ] }, { @@ -106,7 +106,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Example 2" + "## Example 2: Recovery of low-rank image corrupted by sparse noise" ] }, { @@ -126,7 +126,6 @@ } ], "source": [ - "# generate low rank synthetic data\n", "NROWS, NCOLS = 100, 150\n", "NUM_GROUPS = 6\n", "P_MISSING = 0.1\n", @@ -183,7 +182,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Example 3" + "## Example 3: Recovery of time series data corrupted by random spikes" ] }, {