From d8c728c6cdbc0369f0011b536b83f3ece8d7be54 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:13:11 +0000 Subject: [PATCH 01/14] [pre-commit.ci] autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/commitizen-tools/commitizen: v3.30.0 → v4.0.0](https://github.com/commitizen-tools/commitizen/compare/v3.30.0...v4.0.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b98881e..534b6b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,7 +66,7 @@ repos: args: [--line-length=88] - repo: https://github.com/commitizen-tools/commitizen - rev: v3.30.0 + rev: v4.0.0 hooks: - id: commitizen # 确保commit信息遵循Conventional Commits标准 From 4237e20ad163138ef379cdb1e31a28bd5ea71f90 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:17:57 +0000 Subject: [PATCH 02/14] [pre-commit.ci] autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/asottile/pyupgrade: v3.19.0 → v3.19.1](https://github.com/asottile/pyupgrade/compare/v3.19.0...v3.19.1) - [github.com/commitizen-tools/commitizen: v4.0.0 → v4.1.0](https://github.com/commitizen-tools/commitizen/compare/v4.0.0...v4.1.0) - [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.14.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 534b6b8..e396e21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,7 +52,7 @@ repos: ] - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.19.1 hooks: - id: pyupgrade # 将Python代码升级到新版本的Python语法 @@ -66,7 +66,7 @@ repos: args: [--line-length=88] - repo: https://github.com/commitizen-tools/commitizen - rev: v4.0.0 + rev: v4.1.0 hooks: - id: commitizen # 确保commit信息遵循Conventional Commits标准 @@ -83,7 +83,7 @@ repos: types: [ python ] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.13.0 + rev: v1.14.1 hooks: - id: mypy args: [ --ignore-missing-imports,--disallow-untyped-defs, --show-error-codes ] From 476ccea25a1b2ef780a4d84526542d1e7a3d2dda Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:38:09 +0800 Subject: [PATCH 03/14] Delete .github/workflows/ci.yml --- .github/workflows/ci.yml | 66 ---------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ded7e52..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: CI/CD - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - test: - name: Run Tests / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} - strategy: - matrix: - os: [ ubuntu-latest ] - python-version: [ "3.10", "3.11", "3.12"] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies with uv - run: | - # Install latest uv version using the installer - curl -LsSf https://astral.sh/uv/install.sh | sh - uv sync --all-extras --dev - - - name: Run tests - run: uv run scripts.py - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - semantic-release: - name: Semantic Release and Publish - runs-on: ubuntu-latest - needs: test - if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.merged == true) - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.ATTICUS_PAT }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install dependencies with uv - run: | - # Install latest uv version using the installer - curl -LsSf https://astral.sh/uv/install.sh | sh - uv sync --all-extras --dev - - - name: Pull latest changes - run: git pull origin main - - name: Python Semantic Release - uses: python-semantic-release/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} From 3af62b45c8e5968906613c50ec8377646662ef01 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:38:28 +0800 Subject: [PATCH 04/14] Delete .github/workflows/docker-image.yml --- .github/workflows/docker-image.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 5885c83..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,27 +0,0 @@ -# name: Build and Push FastAPI Docker Image - -# on: -# push: -# branches: -# - main - -# jobs: -# build-and-push: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 - -# - name: Log in to Docker Hub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKER_HUB_USERNAME }} -# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - -# - name: Build and push Docker image -# uses: docker/build-push-action@v6 -# with: -# context: ./ -# file: ./Dockerfile -# push: true -# tags: atticuszhou/supafast:latest From 6b6750f128efc6a72ab47e295e812bd48369d19d Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:38:51 +0800 Subject: [PATCH 05/14] Create main.yml --- .github/workflow/main.yml | 82 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflow/main.yml diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml new file mode 100644 index 0000000..1bbf05f --- /dev/null +++ b/.github/workflow/main.yml @@ -0,0 +1,82 @@ +name: Test And Release + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + name: Run Tests / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} + strategy: + matrix: + os: [ ubuntu-latest ] + python-version: ["3.10", "3.11", "3.12", "3.13"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + - name: Install brew + run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + - name: Install Supabase + run: brew install supabase/tap/supabase + + - name: Start supabase + run: supabase start + + - name: Update .env + run: bash scripts/update-env.sh + + - name: Set up Python ${{ matrix.python-version }} + run: uv python install ${{ matrix.python-version }} + + - name: Install dependencies + run: | + cd backend + uv sync --python ${{ matrix.python-version }} --all-extras --dev + + - name: Run tests + run: | + uv run bash scripts/pre-start.sh + uv run bash scripts/tests-start.sh + + release: + name: Bump Version and Release + needs: test + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + + - name: Install dependencies + run: uv sync --dev + + - name: Generate a changelog + env: + ATTICUS_PAT: ${{ secrets.ATTICUS_PAT }} + run: uv run git-cliff -vv --latest --strip header --github-token "$ATTICUS_PAT" -o CHANGES.md + + - name: Release + uses: softprops/action-gh-release@v2 + with: + body_path: CHANGES.md + token: ${{ secrets.GITHUB_TOKEN }} + +# Reference +# 1. https://docs.astral.sh/uv/guides/integration/github/#syncing-and-running +# 2. https://github.com/Kludex/python-template/blob/main/.github/workflows/main.yml +# 3. https://github.com/softprops/action-gh-release/tree/master/ From 741025baaddabf7aad837911d2391dde29545bde Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:39:48 +0800 Subject: [PATCH 06/14] Rename main.yml to main.yml --- .github/{workflow => workflows}/main.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/main.yml (100%) diff --git a/.github/workflow/main.yml b/.github/workflows/main.yml similarity index 100% rename from .github/workflow/main.yml rename to .github/workflows/main.yml From 63b45cfde7dfdfbd0ccd2f6efa88c5700965789c Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:44:05 +0800 Subject: [PATCH 07/14] Update main.yml --- .github/workflows/main.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bbf05f..183981d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,8 +22,14 @@ jobs: with: enable-cache: true - name: Install brew - run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + - name: Install pg deps + run: apt-get update && apt-get install -y --no-install-recommends\ + libpq-dev \ + gcc \ + && rm -rf /var/lib/apt/lists/* - name: Install Supabase run: brew install supabase/tap/supabase From 36142b8b48abb408668fe5451553091d6b162e93 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:47:15 +0800 Subject: [PATCH 08/14] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 183981d..3123dce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - name: Install pg deps - run: apt-get update && apt-get install -y --no-install-recommends\ + run: sudo apt-get update && apt-get install -y --no-install-recommends\ libpq-dev \ gcc \ && rm -rf /var/lib/apt/lists/* From 2c0e928f8bbe89ea42deb404e8499bc8b0248be1 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:49:02 +0800 Subject: [PATCH 09/14] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3123dce..27f3248 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - name: Install pg deps - run: sudo apt-get update && apt-get install -y --no-install-recommends\ + run: sudo apt-get update && apt-get install -y \ libpq-dev \ gcc \ && rm -rf /var/lib/apt/lists/* From 5a74641b0bd54ac6a88602db09fb9f31e347f603 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:50:31 +0800 Subject: [PATCH 10/14] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27f3248..1e3dbae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,10 +26,10 @@ jobs: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - name: Install pg deps - run: sudo apt-get update && apt-get install -y \ + run: sudo apt-get update && sudo apt-get install -y \ libpq-dev \ gcc \ - && rm -rf /var/lib/apt/lists/* + && sudo rm -rf /var/lib/apt/lists/* - name: Install Supabase run: brew install supabase/tap/supabase From d07ebf477d117d95f5e74daa5b08834f00df42d4 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:51:44 +0800 Subject: [PATCH 11/14] Update main.yml --- .github/workflows/main.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e3dbae..15b09d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,11 +25,7 @@ jobs: run: | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - - name: Install pg deps - run: sudo apt-get update && sudo apt-get install -y \ - libpq-dev \ - gcc \ - && sudo rm -rf /var/lib/apt/lists/* + - name: Install Supabase run: brew install supabase/tap/supabase From ced52c150d08ac4bfced34001450f04563b1c3b0 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:53:16 +0800 Subject: [PATCH 12/14] Update main.yml --- .github/workflows/main.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15b09d1..046d6d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,12 +22,14 @@ jobs: with: enable-cache: true - name: Install brew + run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + - name: Install Supabase run: | - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo >> /home/runner/.bashrc + echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bashrc eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - - - name: Install Supabase - run: brew install supabase/tap/supabase + brew install supabase/tap/supabase - name: Start supabase run: supabase start From 1f5b7105482e43b34b42f12d40f4f14fa0dd0b3e Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:55:49 +0800 Subject: [PATCH 13/14] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 046d6d9..5cca747 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,7 @@ jobs: echo >> /home/runner/.bashrc echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bashrc eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + HOMEBREW_NO_INSTALL_CLEANUP=1 brew install supabase/tap/supabase - name: Start supabase From 618e27b9fa88f22d522251a39fd5c0816106a994 Mon Sep 17 00:00:00 2001 From: Atticus Zeller Date: Thu, 30 Jan 2025 16:57:37 +0800 Subject: [PATCH 14/14] Update main.yml --- .github/workflows/main.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5cca747..56d52b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,12 +31,7 @@ jobs: eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" HOMEBREW_NO_INSTALL_CLEANUP=1 brew install supabase/tap/supabase - - - name: Start supabase - run: supabase start - - - name: Update .env - run: bash scripts/update-env.sh + bash scripts/update-env.sh - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }}