Skip to content

Merge pull request #209 from Mirio/dependabot/pip/develop/django-5.0.7 #461

Merge pull request #209 from Mirio/dependabot/pip/develop/django-5.0.7

Merge pull request #209 from Mirio/dependabot/pip/develop/django-5.0.7 #461

Workflow file for this run

name: CI
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches: ["develop"]
paths-ignore:
- 'CHANGELOG.md'
tags:
- "v*"
pull_request:
branches: ["main", "develop"]
paths-ignore: ["docs/**"]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linter:
name: Linter
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Consider using pre-commit.ci for open source project
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
name: Pytest
runs-on: ubuntu-latest
needs: Linter
services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
redis:
image: redis:7
ports:
- 6379:6379
env:
# postgres://user:password@host:port/database
DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres'
CELERY_BROKER_URL: 'redis://localhost:6379/0'
steps:
- name: Install os packages
run: |
sudo apt update
sudo apt install -y ffmpeg
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: requirements.txt
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
run: coverage run -m pytest
- name: Generate coverage.xml
run: coverage xml
- name: Store coverage
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
dockerbuild:
name: DockerBuild
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: Pytest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
maintainer="Mirio"
org.opencontainers.image.title="VerbaCap"
org.opencontainers.image.description="With VerbaCap is a Podcast Manager you will be able to download and listen to all of your favorite podcasts in a centralized way."
org.opencontainers.image.source="https://github.com/Mirio/verbacap"
org.opencontainers.image.licenses="MIT"
org.opencontainers.image.base.name="docker.io/alpine:3.18"
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: Pytest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download coverage-xml
uses: actions/download-artifact@v4
with:
name: coverage-xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}