Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce dependencies for unittest in actions #257

Merged
merged 12 commits into from
Jan 21, 2022
16 changes: 10 additions & 6 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ jobs:
DB_DATABASE: bk_user_api_test
DB_USER: root
DB_PASSWORD: root
DB_PORT: 3306

steps:
- uses: actions/checkout@v2
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
- uses: samin/mysql-action@v1.3
with:
mysql version: '5.7'
mysql database: ${{ env.DB_DATABASE }}
mysql root password: ${{ env.DB_PASSWORD }}
mysql user: ${{ env.DB_USER }}
mysql password: ${{ env.DB_PASSWORD }}
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -38,7 +42,7 @@ jobs:
- name: Install dependencies
run: |
cd src/api/
poetry config virtualenvs.create false && poetry install
poetry config virtualenvs.create false && bash bin/install_ci_dependencies.sh
- name: Run api unittest
env:
DJANGO_SETTINGS_MODULE: "bkuser_core.config.overlays.unittest"
Expand All @@ -52,7 +56,7 @@ jobs:
DB_USER: ${{ env.DB_USER }}
DB_PASSWORD: ${{ env.DB_PASSWORD }}
DB_HOST: "127.0.0.1"
DB_PORT: "3306"
DB_PORT: ${{ env.DB_PORT }}
run: |
make link
cd src/api
Expand Down
10 changes: 10 additions & 0 deletions src/api/bin/install_ci_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

poetry export -f requirements.txt --dev --without-hashes -o requirements.txt --no-ansi

sed -i '/^--extra-index-url*/d' requirements.txt
sed -i '/gevent/d' requirements.txt
sed -i '/greenlet/d' requirements.txt
sed -i '/gunicorn/d' requirements.txt

pip install -r requirements.txt -i https://pypi.org/simple/