diff --git a/.github/workflows/django.yml b/.github/workflows/django-tests.yml similarity index 96% rename from .github/workflows/django.yml rename to .github/workflows/django-tests.yml index e7c1f1c9..146efc5f 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django-tests.yml @@ -1,6 +1,7 @@ name: Django Tests on: + workflow_dispatch: push: branches: [ "main" ] paths: ["api", "chat", "control", "robosats"] @@ -23,7 +24,8 @@ jobs: python-version: ["3.10.2"] steps: - - uses: actions/checkout@v3 + - name: 'Checkout' + uses: actions/checkout@v3 - name: 'Set up Python ${{ matrix.python-version }}' uses: actions/setup-python@v3 with: diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml new file mode 100644 index 00000000..47d8ee2a --- /dev/null +++ b/.github/workflows/frontend-tests.yml @@ -0,0 +1,42 @@ +name: Frontend Tests + +on: + workflow_dispatch: + push: + branches: [ "main" ] + paths: [ "frontend" ] + pull_request: + branches: [ "main" ] + paths: [ "frontend" ] + +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +permissions: + contents: read + pull-requests: read + +jobs: + build: + runs-on: ubuntu-latest + env: + DEVELOPMENT: 1 + + steps: + - name: 'Checkout' + uses: actions/checkout@v3 + - name: 'Setup node' + uses: actions/setup-node@v3 + with: + node-version: 16.16.0 + cache: npm + cache-dependency-path: frontend/package-lock.json + - name: 'Install NPM Dependencies' + run: | + cd frontend + npm install + - name: 'Tests' + run: | + cd frontend + npm test diff --git a/api/views.py b/api/views.py index 17ad0bf1..fade4027 100644 --- a/api/views.py +++ b/api/views.py @@ -708,7 +708,7 @@ class UserView(APIView): image_path = avatar_path.joinpath(nickname + ".png") if not image_path.exists(): with open(image_path, "wb") as f: - rh.img.save(f, format="png") + rh.img.save(f, format="png", optimize=True) # Create new credentials and login if nickname is new if len(User.objects.filter(username=nickname)) == 0: