Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
feat: try to test with a database
Browse files Browse the repository at this point in the history
  • Loading branch information
fbraem committed Jul 29, 2023
1 parent 7efc49d commit 8c1b3b4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .github/workflows/backend_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
paths:
- "backend/src/**"
workflow_dispatch:
env:
KWAI_DB_NAME: ${{ secrets.KWAI_DB_NAME }}
KWAI_DB_USER_NAME: ${{ secrets.KWAI_DB_USER_NAME }}
KWAI_DB_PASSWORD: ${{ secrets.KWAI_DB_PASSWORD }}
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -23,6 +27,32 @@ jobs:
- name: Install dependencies
working-directory: backend/src
run: poetry install
- name: Start MySQL
run: sudo systemctl start mysql.service
- name: Create Kwai Settings
env:
KWAI_JWT_SECRET: ${{ secrets.KWAI_JWT_SECRET }}
run: |
cat <<EOF > .kwai.toml
[security]
jwt_secret="$KWAI_JWT_SECRET"
jwt_refresh_secret="$KWAI_JWT_SECRET"
[db]
host="localhost"
name="$KWAI_DB_NAME"
user="$KWAI_DB_USER_NAME"
password="$KWAI_DB_PASSWORD"
EOF
- name: Migrate database
uses: actions/dbmate-action@v1.15
with:
command: 'up'
env:
DATABASE_URL: mysql://localhost/${{secrets.KWAI_DB_NAME}}
DBMATE_MIGRATIONS_DIR: "./backend/migrations"
DBMATE_NO_DUMP_SCHEMA: "true"
DBMATE_WAIT: "true"
DBMATE_WAIT_TIMEOUT: "30s"
- name: Test with pytest
working-directory: backend/src
run: poetry run pytest --cov=kwai -m "not api and not db and not mail and not bus"
run: poetry run pytest --cov=kwai -m "not api and not mail and not bus"

0 comments on commit 8c1b3b4

Please sign in to comment.