minor typo #1941
This file contains 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: Python package | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: ddp | |
POSTGRES_PASSWORD: ${{ secrets.DBPASSWORD }} | |
POSTGRES_DB: ${{ secrets.DBNAME }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd "pg_isready -U ddp" --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
redis-version: [6] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: ${{ matrix.redis-version }} | |
- name: Create logs directory | |
run: mkdir -p ddpui/logs | |
- name: Create whitelist.py | |
run: cp ddpui/assets/whitelist.template.py ddpui/assets/whitelist.py | |
- name: Apply database migrations | |
env: | |
DBHOST: localhost | |
DBPORT: 5432 | |
DBNAME: ${{ secrets.DBNAME }} | |
DBUSER: ddp | |
DBPASSWORD: ${{ secrets.DBPASSWORD }} | |
run: | | |
python manage.py migrate | |
- name: Create known_hosts file | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/known_hosts | |
- name: Add remote host key to known_hosts | |
run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts | |
- name: Set up port forwarding via SSH | |
run: | | |
eval `ssh-agent -s` | |
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
ssh -L 8080:localhost:8080 -L 8001:localhost:8001 ${{ secrets.SERVER }} -f -N | |
- name: Test with pytest | |
env: | |
AIRBYTE_SERVER_HOST: localhost | |
AIRBYTE_SERVER_PORT: 8001 | |
AIRBYTE_SERVER_APIVER: v1 | |
AIRBYTE_API_TOKEN: ${{ secrets.AIRBYTE_API_TOKEN }} | |
DBHOST: localhost | |
DBPORT: 5432 | |
DBNAME: ${{ secrets.DBNAME }} | |
DBUSER: ddp | |
DBPASSWORD: ${{ secrets.DBPASSWORD }} | |
PREFECT_PROXY_API_URL: http://localhost:8080 | |
DEV_SECRETS_DIR: /tmp/ | |
CLIENTDBT_ROOT: /tmp | |
run: | | |
coverage run --omit ddpui/api/superset_api.py,ddpui/api/task_api.py,ddpui/migrations/*.py,ddpui/celeryworkers/*.py -m pytest --durations=20 | |
coverage xml | |
coverage report --fail-under=70 | |
- name: Check coverage percentage | |
run: | | |
coverage_percentage=$(coverage report --show-missing | tail -n 1 | awk '{print $4}') | |
if (( $(echo "$coverage_percentage < 70" | bc -l) )); then | |
echo "Coverage percentage is below 70%" | |
exit 1 | |
fi | |
- name: Upload coverage reports to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |