From 44a2f8d4da533ecc22e544d33ba475fa9b397038 Mon Sep 17 00:00:00 2001 From: Gautier Dagan Date: Fri, 15 Dec 2023 11:56:20 +0000 Subject: [PATCH] workflow --- .github/workflows/CI.yml | 45 +++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d70e37f..e3631c5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,17 +6,45 @@ name: CI on: - workflow_run: - workflows: ["test"] - branches: [release] - types: - - completed + release: + types: [created] permissions: contents: read jobs: + test: + name: Test for ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu"] + runs-on: ${{ matrix.os }}-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: "3.10" + cache: "pip" + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: llvm-tools-preview + - name: Setup virtual environment + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + - name: Run tests + run: | + source venv/bin/activate + cargo test + maturin develop --release + pytest tests + linux: + needs: [test] runs-on: ubuntu-latest strategy: matrix: @@ -40,6 +68,7 @@ jobs: path: dist windows: + needs: [test] runs-on: windows-latest strategy: matrix: @@ -63,6 +92,7 @@ jobs: path: dist macos: + needs: [test] runs-on: macos-latest strategy: matrix: @@ -85,6 +115,7 @@ jobs: path: dist sdist: + needs: [test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -104,14 +135,14 @@ jobs: runs-on: ubuntu-latest needs: [linux, windows, macos, sdist] if: "startsWith(github.ref, 'refs/tags/')" + permissions: + id-token: write steps: - uses: actions/download-artifact@v3 with: name: wheels - name: Publish to PyPI uses: PyO3/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} with: command: upload args: --non-interactive --skip-existing *