Skip to content

Commit

Permalink
👷‍ Add CI step for pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bdsoha committed Aug 30, 2023
1 parent e796724 commit b2ee23c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- docs/**
- .github/workflows/docs.yml

pull_request:
branches: [ main ]
paths-ignore:
Expand All @@ -16,31 +17,23 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.9]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip virtualenv
virtualenv venv
source venv/bin/activate
pip install -e .[test]
- name: Lint with flake8
run: |
source venv/bin/activate
flake8 --show-source --statistics
- name: Check imports with isort
run: |
source venv/bin/activate
isort . --check-only --diff
- name: Run Pyre
run: |
source venv/bin/activate
pyre check
run: pip install -e .[test]

- name: Lint with pre-commit
run: pre-commit run --all-files
27 changes: 14 additions & 13 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Build Docker image

on:
push:
branches: main
tags:
- v*

workflow_dispatch:

jobs:
buildx:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Prepare
- uses: actions/checkout@v3

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=keshavdv/unifi-cam-proxy
Expand All @@ -33,21 +35,20 @@ jobs:
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
Expand Down
2 changes: 1 addition & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ MD013:
line_length: 100
code_block_line_length: 120

MD041: false
MD041: false
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ repos:
rev: 6.1.0
hooks:
- id: flake8

- repo: local
hooks:
- id: pyre
name: pyre
entry: pyre check
pass_filenames: false
language: python
types:
- python
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test = [
"isort",
"flake8",
"flake8-bugbear",
"pre-commit",
"pyre-check",
"pytest",
"wheel"
Expand Down

0 comments on commit b2ee23c

Please sign in to comment.