From 8b5d0f2da06af49e2c485529a06c1c3cc3c94a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 00:58:57 +0800 Subject: [PATCH 1/8] chore: add supabase in github action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 github action 中增加 supabase 镜像 --- .github/workflows/pr-tests.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 4eb226ca..0714930e 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -24,6 +24,20 @@ env: PETERCAT_ENV: unittest jobs: + supabase: + runs-on: ubuntu-latest + services: + postgres: + image: supabase/postgres:latest + ports: + - 5432:5432 + env: + POSTGRES_PASSWORD: postgres + kong: + image: supabase/kong:latest + ports: + - 8000:8000 + build: runs-on: ubuntu-latest environment: Preview @@ -42,7 +56,7 @@ jobs: role-to-assume: arn:aws:iam::654654285942:role/Github-OIDC audience: sts.amazonaws.com aws-region: ${{ env.AWS_REGION }} - + - name: Set up Python uses: actions/setup-python@v5 with: @@ -59,6 +73,18 @@ jobs: run: | ruff check --output-format=github . + - name: Run Supabase CLI using Docker + env: + SUPABASE_DB_URL: postgres://postgres:postgres@localhost:5432/postgres + run: | + docker run --rm \ + -e SUPABASE_ACCESS_TOKEN=${{ secrets.SUPABASE_ACCESS_TOKEN }} \ + -e SUPABASE_URL=${{ secrets.SUPABASE_URL }} \ + -e SUPABASE_DB_URL=${SUPABASE_DB_URL} \ + -v $(pwd):/migrations \ + supabase/cli \ + supabase db push + - name: Run tests run: pytest --cov From 176456605b832d5124fa3720905477d21fb2d536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:03:07 +0800 Subject: [PATCH 2/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 0714930e..45bae408 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -24,8 +24,9 @@ env: PETERCAT_ENV: unittest jobs: - supabase: + build: runs-on: ubuntu-latest + environment: Preview services: postgres: image: supabase/postgres:latest @@ -37,10 +38,6 @@ jobs: image: supabase/kong:latest ports: - 8000:8000 - - build: - runs-on: ubuntu-latest - environment: Preview strategy: fail-fast: true defaults: From 9d54dac13dcaaa0431c0f8427f635656e2c189ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:05:52 +0800 Subject: [PATCH 3/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 45bae408..b7ebafb6 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -29,15 +29,11 @@ jobs: environment: Preview services: postgres: - image: supabase/postgres:latest + image: supabase/postgres ports: - 5432:5432 env: POSTGRES_PASSWORD: postgres - kong: - image: supabase/kong:latest - ports: - - 8000:8000 strategy: fail-fast: true defaults: From 8207f94d9e3e68861bcb9dc03fc5302b8e1ba528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:07:49 +0800 Subject: [PATCH 4/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index b7ebafb6..731a6655 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -29,7 +29,7 @@ jobs: environment: Preview services: postgres: - image: supabase/postgres + image: supabase/postgres:15.6.1.116 ports: - 5432:5432 env: From c6a5ab5f74169f98bf961c2867f849607e1f7b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:13:24 +0800 Subject: [PATCH 5/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 731a6655..b6308257 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -50,6 +50,14 @@ jobs: audience: sts.amazonaws.com aws-region: ${{ env.AWS_REGION }} + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: Install Supabase CLI + run: npm install -g supabase@latest + - name: Set up Python uses: actions/setup-python@v5 with: @@ -66,17 +74,12 @@ jobs: run: | ruff check --output-format=github . - - name: Run Supabase CLI using Docker + - name: Run Supabase Migration env: SUPABASE_DB_URL: postgres://postgres:postgres@localhost:5432/postgres run: | - docker run --rm \ - -e SUPABASE_ACCESS_TOKEN=${{ secrets.SUPABASE_ACCESS_TOKEN }} \ - -e SUPABASE_URL=${{ secrets.SUPABASE_URL }} \ - -e SUPABASE_DB_URL=${SUPABASE_DB_URL} \ - -v $(pwd):/migrations \ - supabase/cli \ - supabase db push + cd migrations + supabase db push - name: Run tests run: pytest --cov From cf37b2055ca0807c6e7e35e4d859088c439ce1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:15:38 +0800 Subject: [PATCH 6/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index b6308257..d9308697 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -54,9 +54,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: '20.x' - - - name: Install Supabase CLI - run: npm install -g supabase@latest - name: Set up Python uses: actions/setup-python@v5 @@ -79,7 +76,7 @@ jobs: SUPABASE_DB_URL: postgres://postgres:postgres@localhost:5432/postgres run: | cd migrations - supabase db push + npx supabase db push - name: Run tests run: pytest --cov From 8608dc28012d7e66aaa6e3da4b8ed3259a3ae40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:20:13 +0800 Subject: [PATCH 7/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index d9308697..14d6873b 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -55,33 +55,34 @@ jobs: with: node-version: '20.x' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12.0' + # - name: Set up Python + # uses: actions/setup-python@v5 + # with: + # python-version: '3.12.0' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install ruff - pip install pytest pytest-cov + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + # pip install ruff + # pip install pytest pytest-cov - - name: Lint with Ruff - run: | - ruff check --output-format=github . + # - name: Lint with Ruff + # run: | + # ruff check --output-format=github . - name: Run Supabase Migration env: SUPABASE_DB_URL: postgres://postgres:postgres@localhost:5432/postgres run: | - cd migrations + pwd + cd ./migrations npx supabase db push - - name: Run tests - run: pytest --cov + # - name: Run tests + # run: pytest --cov - - name: Upload results to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + # - name: Upload results to Codecov + # uses: codecov/codecov-action@v4 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 97aace84ca2ba8d2dbe1ea2a5352a4f52d797c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Wed, 4 Sep 2024 01:29:40 +0800 Subject: [PATCH 8/8] Update pr-tests.yml --- .github/workflows/pr-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 14d6873b..c88813e4 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -75,8 +75,7 @@ jobs: env: SUPABASE_DB_URL: postgres://postgres:postgres@localhost:5432/postgres run: | - pwd - cd ./migrations + cd ../migrations npx supabase db push # - name: Run tests