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

feat!: Project dust-off #62

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
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/[email protected]
# with:
# extra_args: >
# rich-codex
# --all-files
41 changes: 41 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 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 <[email protected]"

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
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
<div align="center">
<img src="frontend/src/images/[email protected]" alt="Tape Drive Logo" />

[![Gitlab pipeline status](https://img.shields.io/gitlab/pipeline/janw/tapedrive)](https://gitlab.com/janw/tapedrive/-/pipelines?ref=master)
[![Docker Build](https://github.com/janw/tapedrive/actions/workflows/docker-build.yaml/badge.svg)](https://github.com/janw/tapedrive/actions/workflows/docker-build.yaml)
[![Tests](https://github.com/janw/tapedrive/actions/workflows/tests.yaml/badge.svg)](https://github.com/janw/tapedrive/actions/workflows/tests.yaml)

[![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>

Expand Down
Loading
Loading