From 29247df7930d7436ac3f28c6ba1147adb569c128 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 22 May 2025 10:13:22 +0200 Subject: [PATCH] github actions for CI and CD added --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f856cb6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI Pipeline + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.9, "3.10", 3.11, 3.13] + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -e .[dev] + + - name: Lint code with flake8 + run: flake8 + + - name: Type checking with mypy + run: mypy + + - name: Run tests with pytest + run: pytest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ae82350 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + +jobs: + publish: + name: Build and publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Ensure this is main branch + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + run: echo "Proceeding with publish" + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install build tools + run: python -m pip install --upgrade build twine + + - name: Build package + run: python -m build + + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + + run: python -m twine upload dist/*