Skip to content

Commit

Permalink
feat!: Project dust-off
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Jan 19, 2024
1 parent 0a4cb03 commit 580ae7a
Show file tree
Hide file tree
Showing 33 changed files with 2,635 additions and 1,275 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
liberapay: janw
ko_fi: janwxyz
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
labels:
- dependencies
commit-message:
prefix: "build(deps)"
57 changes: 57 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker Build

on:
pull_request:
push:
branches:
- "main"
tags:
- "*"

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get python version from file
run: echo "PYTHON_VERSION=$(cat .python-version)" | tee -a "$GITHUB_ENV"

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: "ghcr.io/${{ github.repository }}"
tags: |
type=ref,event=pr
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{version}}
type=raw,value=edge,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64 # TODO: add `linux/arm64/v8`
build-args: |
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
14 changes: 0 additions & 14 deletions .github/workflows/docker.yaml

This file was deleted.

47 changes: 41 additions & 6 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,45 @@ on:
pull_request:

jobs:
gitlint:
uses: janw/workflows/.github/workflows/gitlint.yaml@main
with:
first-commit: abb56f5
commitizen:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: |
pyproject.toml
sparse-checkout-cone-mode: false

pre-commit:
uses: janw/workflows/.github/workflows/pre-commit.yaml@main
- name: Install commitizen
run: pipx install commitizen

- run: cz check --rev-range origin/main..HEAD
shell: bash

# pre-commit-extras:
# runs-on: ubuntu-latest
# steps:
# - name: Check out
# uses: actions/checkout@v3

# - name: Get python version from file
# run: echo "PYTHON_VERSION=$(cat .python-version)" | tee -a "$GITHUB_ENV"

# - name: Install commitizen
# run: pipx install poetry

# - name: Set up python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# cache: 'poetry'

# - run: poetry install --with=dev

# - uses: pre-commit/action@v3.0.0
# with:
# extra_args: >
# rich-codex
# --all-files
49 changes: 49 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests

on:
pull_request:
push:
branches:
- "main"
tags:
- "*"

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Get python version from file
run: echo "PYTHON_VERSION=$(cat .python-version)" | tee -a "$GITHUB_ENV"

- name: Install poetry
run: pipx install poetry

- name: Set up python environment
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'

- run: poetry install --no-root --with=tests --sync

- run: poetry run pytest --cov --cov-report=xml --cov-report=term

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: coverage-${{ matrix.python-version }}
if: always()

- name: Upload coverage reports to Codeclimate
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: bfeb9df569119f2dfbf094be7ebff7f1c40ab30660d1cb949fc43c3c68618ee6
with:
coverageLocations: |
coverage.xml:coverage.py
if: always()
41 changes: 14 additions & 27 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,34 @@
ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_commit_msg: 'build(deps): [pre-commit.ci] pre-commit autoupdate'

exclude: >
(?x)^(
.+\.svg|
.+/migrations/.+|
.+/fixtures/.+|
.+/cassettes/.+
)$
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.267'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.14'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/psf/black
rev: "23.3.0"
hooks:
- id: black

- repo: local
hooks:
- id: python-no-print
name: check for print()
description: 'A quick check for the `print()` built-in function'
entry: '\bprint\('
language: pygrep
types: [python]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: 'v1.10.0'
hooks:
- id: python-check-blanket-noqa
- id: python-no-eval
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.5.0'
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable

- repo: https://github.com/python-poetry/poetry
rev: '1.4.2'
rev: '1.7.1'
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION

FROM node:16 as frontend
LABEL maintainer="Jan Willhaus <mail@janwillhaus.de"

WORKDIR /frontend
COPY package-lock.json package.json ./
Expand All @@ -9,7 +11,7 @@ COPY vite.config.js ./
COPY frontend ./frontend
RUN npm run build

FROM python:3.7-alpine
FROM python:${PYTHON_VERSION}-alpine
ENV PIP_NO_CACHE_DIR off
ENV PYTHONUNBUFFERED 1

Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@
<div align="center">
<img src="frontend/src/images/icon@2x.png" alt="Tape Drive Logo" />

[![Gitlab pipeline status](https://img.shields.io/gitlab/pipeline/janw/tapedrive)](https://gitlab.com/janw/tapedrive/-/pipelines?ref=master)
[![pipeline status](https://img.shields.io/gitlab/pipeline/janw/tapedrive)](https://gitlab.com/janw/tapedrive/-/pipelines?ref=main)

[![Coverage Status](https://img.shields.io/codeclimate/coverage/janw/tapedrive.svg)](https://codeclimate.com/github/janw/tapedrive)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/janw/tapedrive.svg)](https://codeclimate.com/github/janw/tapedrive)
[![maintainability](https://api.codeclimate.com/v1/badges/e8a6d1046e1aebb4b701/maintainability)](https://codeclimate.com/github/janw/tapedrive/maintainability)
[![coverage](https://api.codeclimate.com/v1/badges/e8a6d1046e1aebb4b701/test_coverage)](https://codeclimate.com/github/janw/tapedrive/test_coverage)
[![pre-commit.ci](https://results.pre-commit.ci/badge/github/janw/tapedrive/main.svg)](https://results.pre-commit.ci/latest/github/janw/tapedrive/main)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Dependency management: poetry](https://img.shields.io/badge/deps-poetry-blueviolet.svg)](https://poetry.eustace.io/docs/)
[![Development Status](https://img.shields.io/badge/status-alpha-orange.svg)](https:///github.com/janw/tapedrive/issues)
[![ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
[![poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/docs/)
[![pre-commit](https://img.shields.io/badge/-pre--commit-f8b424?logo=pre-commit&labelColor=grey)](https://github.com/pre-commit/pre-commit)

</div>

<!-- markdownlint-disable MD033 MD013 -->
<div align="center">

![Podcast Archiver Logo](.assets/icon.png)

[![version](https://img.shields.io/pypi/v/podcast-archiver.svg)](https://pypi.org/project/podcast-archiver/)
[![python](https://img.shields.io/pypi/pyversions/podcast-archiver.svg)](https://pypi.org/project/podcast-archiver/)
[![downloads](https://img.shields.io/pypi/dm/podcast-archiver)](https://pypi.org/project/podcast-archiver/)

</div>

Expand Down
Loading

0 comments on commit 580ae7a

Please sign in to comment.