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

Tooling ehancements #364

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 0 additions & 170 deletions .circleci/config.yml

This file was deleted.

138 changes: 138 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Continuous Integration

# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1

on:
pull_request:
branches:
- master
push:
branches:
- master


jobs:
lint:
runs-on: ubuntu-22.04

steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt

- name: Black
run: |
black . --check

- name: isort
run: |
isort . --check-only --profile black

- name: Flake8
run: |
flake8 tests tenlists

test:
runs-on: ubuntu-22.04
needs: [lint]

env:
TENLISTS_SECRET_KEY_DEV: fake
MAIL_SERVER_DEV: smtp.mailtrap.io
MAIL_PORT_DEV: 2525
TENLISTS_EMAIL_USER_DEV: ''
TENLISTS_EMAIL_PWD_DEV: ''
MAIL_USE_TLS: True
MAIL_USE_SSL: False
TENLISTS_MP3_CLOUD_STORAGE_BASE_URL: https://example.com/path/to/folder
TENLISTS_API_BASE: http://127.0.0.1:8000/ten-lists/api/v1.0/mp3s

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: 'pip'

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- id: node-cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- if: steps.node-cache.outputs.cache-hit != 'true'
run: |
npm ci --no-optional --no-audit --progress=false

- name: System Dependencies
shell: bash
run: |
sudo apt-get update --yes --quiet
sudo apt-get install --yes --quiet --no-install-recommends ffmpeg
grunt all

- name: Install Python dependencies & testing tools
shell: bash
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
curl https://deepsource.io/cli | sh

- name: Create .env file to simulate a development setup
shell: bash
run: |
mkdir -p env/
touch env/.dev.env
echo "TENLISTS_SECRET_KEY_DEV='fake'" >> env/.dev.env
echo "MAIL_SERVER_DEV=smtp.mailtrap.io" >> env/.dev.env
echo "MAIL_PORT_DEV=2525" >> env/.dev.env
echo "TENLISTS_EMAIL_USER_DEV=" >> env/.dev.env
echo "TENLISTS_EMAIL_PWD_DEV=" >> env/.dev.env
echo "MAIL_USE_TLS=True" >> env/.dev.env
echo "MAIL_USE_SSL=False" >> env/.dev.env
echo "TENLISTS_MP3_CLOUD_STORAGE_BASE_URL=https://example.com/path/to/folder" >> env/.dev.env
echo "TENLISTS_API_BASE=http://127.0.0.1:8000/ten-lists/api/v1.0/mp3s" >> env/.dev.env

- name: Run tests
run: |
./cc-test-reporter before-build
pytest
coveralls
./cc-test-reporter after-build --coverage-input-type coverage.py
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml

- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ github.token }}

- name: Codacy Coverage Reporter
uses: codacy/codacy-coverage-reporter-action@v1.3.0
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# or
# api-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports: coverage.xml
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ repos:
hooks:
- id: black
exclude: (.*)/migrations
- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
Loading
Loading