Skip to content

Commit

Permalink
Install pre-commit via docker
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Nov 22, 2023
1 parent eeacdb7 commit c5b32c3
Show file tree
Hide file tree
Showing 73 changed files with 16,512 additions and 16,477 deletions.
78 changes: 78 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Git
.gitignore
.gitattributes


# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# PyBuilder
target/

# Virtual environment
.env
.venv/
venv/

# PyCharm
.idea

# Python mode for VIM
.ropeproject
**/.ropeproject

# Vim swap files
**/*.swp

# VS Code
.vscode/
36 changes: 18 additions & 18 deletions .github/workflows/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: pre-commit

on: [pull_request, push]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10.13
uses: actions/setup-python@v4
with:
python-version: 3.10.13

- name: Pre-commit checks
uses: pre-commit/[email protected]
name: pre-commit

on: [pull_request, push]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10.13
uses: actions/setup-python@v4
with:
python-version: 3.10.13

- name: Pre-commit checks
uses: pre-commit/[email protected]
58 changes: 29 additions & 29 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: unitary

on: ["push"]

jobs:
unitary:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Cache Compiler Installations
uses: actions/cache@v3
with:
path: ~/.vvm
key: compiler-cache

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.6

- name: Install Requirements
run: pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

- name: Run Tests
run: pytest
env:
DRPC_KEY: ${{ secrets.DRPC_KEY }}
name: unitary

on: ["push"]

jobs:
unitary:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Cache Compiler Installations
uses: actions/cache@v3
with:
path: ~/.vvm
key: compiler-cache

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.6

- name: Install Requirements
run: pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

- name: Run Tests
run: pytest
env:
DRPC_KEY: ${{ secrets.DRPC_KEY }}
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.build
build/
.python-version
.idea
.pytest_cache
__pycache__/
.DS_Store
venv/
bvenv/
.env
.build
build/
.python-version
.idea
.pytest_cache
__pycache__/
.DS_Store
venv/
bvenv/
.env
52 changes: 26 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
args: [--line-length=79]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", --line-length=79]

default_language_version:
python: python3.10
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
args: [--line-length=79]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", --line-length=79]

default_language_version:
python: python3.11
26 changes: 16 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
FROM python:3.11-slim

WORKDIR /usr/app
RUN pip cache purge
COPY requirements.txt ./
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

COPY . .
CMD pytest
FROM python:3.11-slim as base

WORKDIR /usr/app
RUN pip cache purge
COPY requirements.txt ./
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

FROM base as pre-commit
RUN apt-get update && apt-get install git
COPY . .
CMD pre-commit run --all-files

FROM base as test
COPY . .
CMD pytest
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2022 Curve

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2022 Curve
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit c5b32c3

Please sign in to comment.