Skip to content

Commit 5eb91a7

Browse files
authored
Merge branch 'develop' into flags-refactor
2 parents b5aef48 + 1dba7f0 commit 5eb91a7

File tree

128 files changed

+2213
-1928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2213
-1928
lines changed

.deepsource.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test_patterns = [
77

88
exclude_patterns = [
99
"helper/**",
10-
"menubar/**"
1110
]
1211

1312
[[analyzers]]

.github/workflows/test-library.yml

Lines changed: 171 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,66 @@ jobs:
540540
flags: pytest, GHA, Python ${{ matrix.python }}, ${{ runner.os }}
541541
verbose: true
542542

543+
test-container:
544+
runs-on: Ubuntu-latest
545+
permissions:
546+
packages: write
547+
if: success()
548+
needs:
549+
- pre-setup # transitive, for accessing settings
550+
- build
551+
name: 🐳 Build & Test
552+
strategy:
553+
fail-fast: false
554+
steps:
555+
- name: Checkout
556+
uses: actions/checkout@v2
557+
with:
558+
ref: ${{ github.event.inputs.release-commitish }}
559+
- name: Download all the dists
560+
uses: actions/download-artifact@v2
561+
with:
562+
name: python-package-distributions
563+
path: dist/
564+
- name: Set up Docker Buildx
565+
id: buildx
566+
uses: docker/setup-buildx-action@v1
567+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
568+
with:
569+
version: v0.7.0
570+
buildkitd-flags: --debug
571+
config: .github/buildkitd.toml
572+
install: true
573+
- name: Enable Multiarch # This slows down arm build by 4-5x
574+
run: |
575+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
576+
- name: Create builder
577+
run: |
578+
docker buildx create --name proxypybuilder
579+
docker buildx use proxypybuilder
580+
docker buildx inspect
581+
docker buildx ls
582+
- name: Build, run & test container
583+
run: >-
584+
CONTAINER_TAG="abhinavsingh/proxy.py:${{
585+
needs.pre-setup.outputs.container-version
586+
}}";
587+
docker buildx build
588+
--load
589+
--build-arg PROXYPY_PKG_PATH='dist/${{
590+
needs.pre-setup.outputs.wheel-artifact-name
591+
}}'
592+
-t $CONTAINER_TAG .
593+
&&
594+
docker run
595+
-d
596+
-p 8899:8899
597+
$CONTAINER_TAG
598+
--hostname 0.0.0.0
599+
--enable-web-server
600+
&&
601+
./tests/integration/test_integration.sh 8899
602+
543603
analyze:
544604
runs-on: ubuntu-latest
545605
name: 🛡️ Analyze
@@ -672,34 +732,15 @@ jobs:
672732
make ca-certificates
673733
python3 -m proxy --version
674734
675-
check: # This job does nothing and is only used for the branch protection
676-
if: always()
677-
678-
needs:
679-
- analyze
680-
- test
681-
- lint
682-
- dashboard
683-
- brew
684-
- developer
685-
686-
runs-on: Ubuntu-latest
687-
688-
steps:
689-
- name: Decide whether the needed jobs succeeded or failed
690-
uses: re-actors/alls-green@release/v1
691-
with:
692-
jobs: ${{ toJSON(needs) }}
693-
694-
docker:
735+
ghcr-latest:
695736
runs-on: Ubuntu-latest
696737
permissions:
697738
packages: write
698739
if: success()
699740
needs:
700-
- check
741+
- test-container
701742
- pre-setup # transitive, for accessing settings
702-
name: 🐳 containerize
743+
name: 🐳 ghcr:latest
703744
strategy:
704745
fail-fast: false
705746
steps:
@@ -736,26 +777,6 @@ jobs:
736777
docker buildx use proxypybuilder
737778
docker buildx inspect
738779
docker buildx ls
739-
- name: Build, run & test container
740-
run: >-
741-
CONTAINER_TAG="abhinavsingh/proxy.py:${{
742-
needs.pre-setup.outputs.container-version
743-
}}";
744-
docker buildx build
745-
--load
746-
--build-arg PROXYPY_PKG_PATH='dist/${{
747-
needs.pre-setup.outputs.wheel-artifact-name
748-
}}'
749-
-t $CONTAINER_TAG .
750-
&&
751-
docker run
752-
-d
753-
-p 8899:8899
754-
$CONTAINER_TAG
755-
--hostname 0.0.0.0
756-
--enable-web-server
757-
&&
758-
./tests/integration/test_integration.sh 8899
759780
- name: Push to GHCR
760781
run: >-
761782
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
@@ -794,6 +815,52 @@ jobs:
794815
needs.pre-setup.outputs.wheel-artifact-name
795816
}}'
796817
-t $LATEST_TAG .
818+
819+
ghcr-openssl:
820+
runs-on: Ubuntu-latest
821+
permissions:
822+
packages: write
823+
if: success()
824+
needs:
825+
- test-container
826+
- pre-setup # transitive, for accessing settings
827+
name: 🐳 ghcr:openssl
828+
strategy:
829+
fail-fast: false
830+
steps:
831+
- name: Checkout
832+
uses: actions/checkout@v2
833+
with:
834+
ref: ${{ github.event.inputs.release-commitish }}
835+
- name: Download all the dists
836+
uses: actions/download-artifact@v2
837+
with:
838+
name: python-package-distributions
839+
path: dist/
840+
- name: Login to GHCR
841+
uses: docker/login-action@v1
842+
with:
843+
registry: ghcr.io
844+
username: ${{ github.actor }}
845+
password: ${{ secrets.GITHUB_TOKEN }}
846+
- name: Set up Docker Buildx
847+
id: buildx
848+
uses: docker/setup-buildx-action@v1
849+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
850+
with:
851+
version: v0.7.0
852+
buildkitd-flags: --debug
853+
config: .github/buildkitd.toml
854+
install: true
855+
- name: Enable Multiarch # This slows down arm build by 4-5x
856+
run: |
857+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
858+
- name: Create builder
859+
run: |
860+
docker buildx create --name proxypybuilder
861+
docker buildx use proxypybuilder
862+
docker buildx inspect
863+
docker buildx ls
797864
- name: Push openssl to GHCR
798865
run: >-
799866
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
@@ -830,6 +897,46 @@ jobs:
830897
needs.pre-setup.outputs.wheel-artifact-name
831898
}}'
832899
-t $LATEST_TAG .
900+
901+
docker-latest:
902+
runs-on: Ubuntu-latest
903+
permissions:
904+
packages: write
905+
if: success()
906+
needs:
907+
- test-container
908+
- pre-setup # transitive, for accessing settings
909+
name: 🐳 docker:latest
910+
strategy:
911+
fail-fast: false
912+
steps:
913+
- name: Checkout
914+
uses: actions/checkout@v2
915+
with:
916+
ref: ${{ github.event.inputs.release-commitish }}
917+
- name: Download all the dists
918+
uses: actions/download-artifact@v2
919+
with:
920+
name: python-package-distributions
921+
path: dist/
922+
- name: Set up Docker Buildx
923+
id: buildx
924+
uses: docker/setup-buildx-action@v1
925+
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167
926+
with:
927+
version: v0.7.0
928+
buildkitd-flags: --debug
929+
config: .github/buildkitd.toml
930+
install: true
931+
- name: Enable Multiarch # This slows down arm build by 4-5x
932+
run: |
933+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
934+
- name: Create builder
935+
run: |
936+
docker buildx create --name proxypybuilder
937+
docker buildx use proxypybuilder
938+
docker buildx inspect
939+
docker buildx ls
833940
- name: Login to DockerHub
834941
uses: docker/login-action@v1
835942
with:
@@ -853,6 +960,28 @@ jobs:
853960
}}'
854961
-t $CONTAINER_TAG .
855962
963+
check: # This job does nothing and is only used for the branch protection
964+
if: always()
965+
966+
needs:
967+
- analyze
968+
- test
969+
- lint
970+
- dashboard
971+
- brew
972+
- developer
973+
- ghcr-latest
974+
- ghcr-openssl
975+
- docker-latest
976+
977+
runs-on: Ubuntu-latest
978+
979+
steps:
980+
- name: Decide whether the needed jobs succeeded or failed
981+
uses: re-actors/alls-green@release/v1
982+
with:
983+
jobs: ${{ toJSON(needs) }}
984+
856985
publish-pypi:
857986
name: Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to PyPI
858987
needs:

.isort.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://github.com/timothycrosley/isort/wiki/isort-Settings
2+
[settings]
3+
default_section = THIRDPARTY
4+
# force_to_top=file1.py,file2.py
5+
# forced_separate = django.contrib,django.utils
6+
include_trailing_comma = true
7+
indent = 4
8+
known_first_party = proxy
9+
# known_future_library = future,pies
10+
# known_standard_library = std,std2
11+
known_testing = pytest,unittest
12+
length_sort = 1
13+
# Should be: 80 - 1
14+
line_length = 79
15+
lines_after_imports = 2
16+
# https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
17+
# NOTE: Another mode could be "5" for grouping multiple "import from" under
18+
# NOTE: a single instruction.
19+
multi_line_output = 5
20+
no_lines_before = LOCALFOLDER
21+
sections=FUTURE,STDLIB,TESTING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
22+
# skip=file3.py,file4.py
23+
use_parentheses = true
24+
verbose = true

.pre-commit-config.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- --py36-plus
99

1010
# - repo: https://github.com/timothycrosley/isort.git
11-
# rev: 5.4.2
11+
# rev: 5.10.0
1212
# hooks:
1313
# - id: isort
1414
# args:
@@ -63,13 +63,6 @@ repos:
6363
src/core/plugins/inspect_traffic\.json|
6464
static/bootstrap-4\.3\.1\.min\.(cs|j)s
6565
)|
66-
menubar/proxy\.py/(
67-
Assets\.xcassets/(
68-
AppIcon\.appiconset/|
69-
StatusBarButtonImage\.imageset/|
70-
)|
71-
Preview\sContent/Preview\sAssets\.xcassets/
72-
)Contents\.json|
7366
requirements-release\.txt
7467
$
7568
- id: requirements-txt-fixer

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
".venv*/**/*.py",
3434
"venv*/**/*.py",
3535
"docs/**/*.py",
36-
"helper/**/*.py",
37-
"menubar/**/*.py"
36+
"helper/**/*.py"
3837
],
3938
"python.linting.pylintEnabled": true,
4039
"python.linting.pylintArgs": ["--generate-members"],

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ exclude ProxyPy.png
22
exclude Dashboard.png
33
exclude shortlink.gif
44
prune dashboard
5-
prune menubar

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif
2828

2929
.PHONY: all https-certificates sign-https-certificates ca-certificates
3030
.PHONY: lib-check lib-clean lib-test lib-package lib-coverage lib-lint lib-pytest
31-
.PHONY: lib-release-test lib-release lib-profile lib-doc
31+
.PHONY: lib-release-test lib-release lib-profile lib-doc lib-pre-commit
3232
.PHONY: lib-dep lib-flake8 lib-mypy lib-speedscope container-buildx-all-platforms
3333
.PHONY: container container-run container-release container-build container-buildx
3434
.PHONY: devtools dashboard dashboard-clean container-without-openssl
@@ -91,16 +91,21 @@ lib-clean:
9191
rm -rf proxy.py.egg-info
9292
rm -rf .pytest_cache
9393
rm -rf .hypothesis
94+
# Doc RST files are cached and can cause issues
95+
# See https://github.com/abhinavsingh/proxy.py/issues/642#issuecomment-1003444578
96+
rm docs/pkg/*.rst
9497

9598
lib-dep:
9699
pip install --upgrade pip && \
97100
pip install \
98-
-r requirements.txt \
99101
-r requirements-testing.txt \
100102
-r requirements-release.txt \
101103
-r requirements-tunnel.txt && \
102104
pip install "setuptools>=42"
103105

106+
lib-pre-commit:
107+
python -m pre_commit run --hook-stage manual --all-files -v
108+
104109
lib-lint:
105110
python -m tox -e lint
106111

0 commit comments

Comments
 (0)