Migrate from Poetry to UV package manager #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| ci-cd: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v1 | |
| with: | |
| version: "0.6.16" | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| uv pip install -e .[dev] | |
| npm ci | |
| - name: Lint with flake8 | |
| run: | | |
| uv run flake8 chatiq | |
| - name: Check code formatting | |
| run: | | |
| uv run black --check chatiq | |
| - name: Check imports with isort | |
| run: | | |
| uv run isort chatiq --check --diff | |
| - name: Run Pytype | |
| run: | | |
| uv run pytype chatiq | |
| - name: Run unit tests and measure code coverage | |
| run: | | |
| uv run coverage run -m pytest | |
| uv run coverage xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v3 | |
| - id: semantic-release | |
| name: Run semantic-release | |
| run: | | |
| npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish package | |
| run: | | |
| uv pip build . | |
| uv pip publish --api-token ${{ secrets.PYPI_API_TOKEN }} | |
| if: ${{ steps.semantic-release.outputs.nextVer != null }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| if: ${{ steps.semantic-release.outputs.nextVer != null }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| if: ${{ steps.semantic-release.outputs.nextVer != null }} | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| if: ${{ steps.semantic-release.outputs.nextVer != null }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v4 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| yujiosaka/chatiq:${{ steps.semantic-release.outputs.nextVer }} | |
| yujiosaka/chatiq:latest | |
| if: ${{ steps.semantic-release.outputs.nextVer != null }} |