Skip to content

build(deps-dev): update dependency ruff to v0.7.4 #124

build(deps-dev): update dependency ruff to v0.7.4

build(deps-dev): update dependency ruff to v0.7.4 #124

Workflow file for this run

name: Continuous Integration
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
POETRY_VERSION: 1.8.3 # Make sure this matches the Dockerfile
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "v*"
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"
- id: poetry-cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- if: steps.poetry-cache.outputs.cache-hit != 'true'
name: Install Poetry and Dependencies
shell: bash
run: |
pip install --upgrade pip
pip install poetry==$POETRY_VERSION
python -m venv .venv
source .venv/bin/activate
poetry install --with dev,test
- name: ruff
shell: bash
run: |
source .venv/bin/activate
ruff check . --output-format=github
- name: Black
shell: bash
run: |
source .venv/bin/activate
black . --check
test:
runs-on: ubuntu-22.04
needs: [lint]
container:
image: python:3.12-slim-bookworm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FLASK_CONFIGURATION: development
FLASK_ENV: development
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://localhost:8000/ten-lists/api/v1.0/mp3s
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: System Dependencies
shell: bash
run: |
apt-get update --yes --quiet
apt-get install --yes --quiet --no-install-recommends build-essential curl ffmpeg git
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
npm install -g grunt-cli
npm ci --cache .npm --prefer-offline
grunt all
- name: Install Python dependencies & testing tools
shell: bash
run: |
pip install --upgrade pip
python -m pip install poetry==1.8.3
poetry install --with dev,test
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://localhost:8000/ten-lists/api/v1.0/mp3s" >> env/.dev.env
- name: Run tests
run: |
poetry run pytest
- name: DeepSource
uses: deepsourcelabs/test-coverage-action@master
with:
key: python
coverage-file: coverage.xml
dsn: ${{ secrets.DEEPSOURCE_DSN }}
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ github.token }}
- name: Codacy Coverage Reporter
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# or
# api-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports: coverage.xml
# Creates a GitHub Release when the lint & test jobs succeeds, and only on pushes to tags.
release:
needs: [lint, test]
permissions:
contents: write
if: needs.test.result == 'success' && startsWith( github.ref, 'refs/tags/v' )
runs-on: ubuntu-22.04
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- id: poetry-cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- if: steps.poetry-cache.outputs.cache-hit != 'true'
name: Install Poetry and Dependencies
shell: bash
run: |
pip install --upgrade pip
pip install poetry==$POETRY_VERSION
python -m venv .venv
source .venv/bin/activate
poetry install --with dev,test
- name: Get the version
id: get_version
run: |
echo "${{ github.ref }}"
echo "VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///')" >> $GITHUB_ENV
- name: Generate Release Title
id: get_release_title
shell: bash
run: |
export TODAY="($(TZ=Africa/Lusaka date --iso))"
echo "RELEASE_NAME=$VERSION $TODAY" >> $GITHUB_ENV
- name: Extract Release Notes
# This creates a file LATEST_RELEASE_NOTES.md in the parent directory (../)
shell: bash
run: |
source .venv/bin/activate
invoke get-release-notes
- name: GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.RELEASE_NAME }}
body_path: ../LATEST_RELEASE_NOTES.md