Skip to content

Commit

Permalink
Add linting CLI (#26)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: always-on-duty[bot] <120557446+always-on-duty[bot]@users.noreply.github.com>
  • Loading branch information
FasterSpeeding and always-on-duty[bot] authored Apr 7, 2024
1 parent 7e68604 commit 94dd48a
Show file tree
Hide file tree
Showing 22 changed files with 752 additions and 778 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ name: Docker

on:
schedule:
- cron: '19 14 * * *'
- cron: "25 14 * * *"
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: [ "v*.*.*" ]
pull_request:
branches: [ "master" ]

Expand All @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/freeze-for-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Freeze PR dependency changes

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
paths: ["piped", "pyproject.toml", "requirements.in", "dev-requirements/*.in", "!dev-requirements/constraints.in"]

jobs:
freeze-pr-dep-changes:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Upgrade dependency locks
run: python -m nox -s freeze-locks bot-package-diff

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 12 * * 6"
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Check spelling
run: python -m nox -s spell-check

- name: Lint with flake8
run: python -m nox -s flake8
40 changes: 40 additions & 0 deletions .github/workflows/reformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reformat PR code

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master

jobs:
reformat:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Reformat
run: python -m nox -s reformat bot-package-diff

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
41 changes: 41 additions & 0 deletions .github/workflows/resync-piped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Resync piped

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
paths: ["piped", "piped.toml", "pyproject.toml"]

jobs:
resync-piped:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Resync Piped
run: python -m nox -s copy-piped bot-package-diff

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
38 changes: 38 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Type check

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 12 * * 6"
workflow_dispatch:

jobs:
type-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Run type checker
run: python -m nox -s type-check
4 changes: 2 additions & 2 deletions .github/workflows/upgrade-locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@8eb1f6a495037164bea451156472f35fdd6bafc0
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

Expand All @@ -22,7 +22,7 @@ jobs:
- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./dev-requirements.txt
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Upgrade dependency locks
run: python -m nox -s freeze-locks
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify-locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
pull_request:
branches:
- master
paths: ["requirements.txt", "dev-requirements.txt"]
paths: ["dev-requirements/*.txt"]

jobs:
verify-pr-dep-changes:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@8eb1f6a495037164bea451156472f35fdd6bafc0
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

Expand All @@ -30,7 +30,7 @@ jobs:
- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./dev-requirements.txt
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Verify dependency locks
run: python -m nox -s verify-locks
run: python -m nox -s verify-deps
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "piped"]
path = piped
url = https://github.com/FasterSpeeding/Piped.git
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
FROM python:3.11-buster
COPY . .

WORKDIR /code

COPY ./runner.py ./runner.py
COPY ./dev-requirements/constraints.txt ./requirements.txt

RUN pip install -Ur requirements.txt

ENTRYPOINT python runner.py
2 changes: 0 additions & 2 deletions dev-requirements.in

This file was deleted.

Loading

0 comments on commit 94dd48a

Please sign in to comment.