diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e7594de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run tests + run: | + pytest tests/ -v + + - name: Test package installation + run: | + pip install -e . + python -c "from xflow import CEMLflowPlugin, ReportGenerator; print('Import successful')" + + - name: Test basic functionality + run: | + python test_plugin_auto_mpg.py \ No newline at end of file diff --git a/.github/workflows/publish-prod.yml b/.github/workflows/publish-prod.yml new file mode 100644 index 0000000..fa2b62f --- /dev/null +++ b/.github/workflows/publish-prod.yml @@ -0,0 +1,68 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*' # Trigger on version tags like v1.0.0, v1.2.3, etc. + +jobs: + publish-prod: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Extract version from tag + id: extract_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Extracted version: $VERSION" + + - name: Update version in pyproject.toml + run: | + sed -i 's/version = "[^"]*"/version = "${{ steps.extract_version.outputs.version }}"/' pyproject.toml + echo "Updated pyproject.toml version to ${{ steps.extract_version.outputs.version }}" + + - name: Build package + run: python -m build + + - name: Check package + run: python -m twine check dist/* + + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m twine upload dist/* + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ steps.extract_version.outputs.version }} + body: | + ## Changes in this Release + + Please see the [CHANGELOG.md](CHANGELOG.md) for detailed changes. + + ## Installation + + ```bash + pip install xflow==${{ steps.extract_version.outputs.version }} + ``` + draft: false + prerelease: false \ No newline at end of file diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml new file mode 100644 index 0000000..22c873c --- /dev/null +++ b/.github/workflows/publish-test.yml @@ -0,0 +1,36 @@ +name: Publish to Test PyPI + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (optional, will use pyproject.toml version if not specified)' + required: false + type: string + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine build + + - name: Build package + run: python -m build + + - name: Publish package to Test PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} + run: twine upload --repository-url https://test.pypi.org/legacy/ dist/* \ No newline at end of file