Skip to content

Commit

Permalink
move from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
teticio committed Sep 13, 2021
1 parent fe22226 commit 5876b39
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 12 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install ffmpeg -y
npm install -g [email protected]
yarn install
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements-lock.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and yarn
run: |
yarn build
python download.py
APP_URL=http://localhost:3000 uvicorn backend.main:app --port=8001 &
pytest backend
yarn test
2 changes: 1 addition & 1 deletion .travis.yml → .travis_old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ before_install:
- npm install -g [email protected]
install:
- yarn install
- pip install -r requirements-lock.txt
- pip install pytest
- pip install -r requirements-lock.txt
script:
- yarn build
- python download.py
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sqlalchemy-utils = "*"
yapf = "*"
pytest = "*"
pylint = "*"
flake8 = "*"

[requires]
python_version = "3.8"
34 changes: 29 additions & 5 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async def widget(track_id: str):
"""
headers = {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' \
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/92.0.4515.159 Safari/537.36'
}
async with aiohttp.ClientSession() as session:
Expand Down
1 change: 0 additions & 1 deletion backend/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ class Playlist(BaseModel): # pylint: disable=too-few-public-methods
waypoints: Optional[str] = ''
creativity: Optional[float] = 0.5
noise: Optional[float] = 0

6 changes: 2 additions & 4 deletions backend/test_deejai.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import asyncio
from datetime import datetime

import pytest # pylint: disable=unused-import

from . import main
from . import schemas

Expand Down Expand Up @@ -113,8 +111,8 @@ def test_search_similar():
"""
assert asyncio.run(
main.search_similar_tracks(
url=
'https://p.scdn.co/mp3-preview/04b28b12174a4c4448486070962dae74494c0f70?' \
url='https://p.scdn.co/mp3-preview'
'/04b28b12174a4c4448486070962dae74494c0f70?'
'cid=194086cb37be48ebb45b9ba4ce4c5936',
max_items=10)) == [{
'track_id': '1a9SiOELQS7YsBQwdEPMuq',
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ librosa
yapf
pytest
pylint
flake8

0 comments on commit 5876b39

Please sign in to comment.