2019-11-19 17:15:08 +00:00
|
|
|
name: CI
|
|
|
|
|
2021-05-11 09:17:09 +00:00
|
|
|
on: [ push, pull_request ]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint-pr:
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
- uses: TrueBrain/actions-flake8@9a43ff1b2c7b96f3edffc48a49973ce3de116ba1
|
|
|
|
# mirrored at https://github.com/mitmproxy/mitmproxy/settings/actions
|
2020-04-08 18:29:07 +00:00
|
|
|
lint-local:
|
2019-11-19 17:15:08 +00:00
|
|
|
if: github.event_name == 'push'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2021-05-11 09:17:09 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2019-12-31 15:03:45 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e flake8
|
2020-04-08 18:29:07 +00:00
|
|
|
filename-matching:
|
2019-12-31 15:03:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2021-05-11 09:17:09 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2019-12-31 15:03:45 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e filename_matching
|
2019-11-19 17:15:08 +00:00
|
|
|
mypy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2021-05-11 09:17:09 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2019-12-31 15:03:45 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e mypy
|
2020-04-08 18:29:07 +00:00
|
|
|
individual-coverage:
|
2019-12-31 15:03:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2021-05-11 09:17:09 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2019-12-31 15:03:45 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e individual_coverage
|
2019-11-19 17:15:08 +00:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-07-27 16:06:55 +00:00
|
|
|
include:
|
2021-08-06 08:03:24 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
py: '3.10.0-rc - 3.10'
|
2020-07-27 16:06:55 +00:00
|
|
|
- os: windows-latest
|
2020-10-05 20:52:09 +00:00
|
|
|
py: 3.9
|
2020-07-27 16:06:55 +00:00
|
|
|
- os: macos-latest
|
2020-10-05 20:52:09 +00:00
|
|
|
py: 3.9
|
2020-08-26 21:54:35 +00:00
|
|
|
- os: ubuntu-latest
|
2020-10-05 20:52:09 +00:00
|
|
|
py: 3.9
|
2020-07-27 16:06:55 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
py: 3.8
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- run: printenv
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-07-27 16:06:55 +00:00
|
|
|
python-version: ${{ matrix.py }}
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: pip install tox
|
2020-07-27 16:06:55 +00:00
|
|
|
- run: tox -e py
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27
|
|
|
|
# mirrored below and at https://github.com/mitmproxy/mitmproxy/settings/actions
|
2020-04-08 18:29:07 +00:00
|
|
|
with:
|
|
|
|
file: ./coverage.xml
|
|
|
|
name: ${{ matrix.os }}
|
2021-05-11 09:17:09 +00:00
|
|
|
|
|
|
|
build:
|
2019-11-19 17:15:08 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-05-11 09:17:09 +00:00
|
|
|
include:
|
|
|
|
- image: macos-10.15
|
|
|
|
platform: macos
|
|
|
|
- image: windows-2019
|
|
|
|
platform: windows
|
2021-09-21 20:31:58 +00:00
|
|
|
- image: ubuntu-18.04 # Old Ubuntu version for old glibc
|
2021-05-11 09:17:09 +00:00
|
|
|
platform: linux
|
|
|
|
runs-on: ${{ matrix.image }}
|
2019-11-19 17:15:08 +00:00
|
|
|
env:
|
2021-05-11 09:17:09 +00:00
|
|
|
CI_BUILD_WHEEL: ${{ matrix.platform == 'linux' }}
|
2019-11-19 17:15:08 +00:00
|
|
|
CI_BUILD_PYINSTALLER: 1
|
2021-05-11 09:17:09 +00:00
|
|
|
CI_BUILD_WININSTALLER: ${{ matrix.platform == 'windows' }}
|
2019-11-19 17:15:08 +00:00
|
|
|
CI_BUILD_KEY: ${{ secrets.CI_BUILD_KEY }}
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-12-05 23:04:45 +00:00
|
|
|
python-version: '3.9'
|
2021-05-11 09:17:09 +00:00
|
|
|
- if: matrix.platform == 'windows'
|
|
|
|
uses: actions/cache@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
path: release/installbuilder/setup
|
|
|
|
key: installbuilder
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: pip install -e .[dev]
|
|
|
|
- run: python release/cibuild.py build
|
2019-11-19 17:15:08 +00:00
|
|
|
# artifacts must have different names, see https://github.com/actions/upload-artifact/issues/24
|
2020-07-27 16:06:55 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2021-05-11 09:17:09 +00:00
|
|
|
name: binaries.${{ matrix.platform }}
|
2019-11-19 17:15:08 +00:00
|
|
|
path: release/dist
|
|
|
|
|
|
|
|
test-web-ui:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: git rev-parse --abbrev-ref HEAD
|
2021-06-20 00:12:59 +00:00
|
|
|
- uses: actions/setup-node@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2021-06-20 00:12:59 +00:00
|
|
|
node-version: '14'
|
|
|
|
- name: Cache Node.js modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
|
2019-11-19 17:15:08 +00:00
|
|
|
restore-keys: |
|
2021-06-20 00:12:59 +00:00
|
|
|
${{ runner.OS }}-node-
|
|
|
|
${{ runner.OS }}-
|
2019-11-19 17:15:08 +00:00
|
|
|
- working-directory: ./web
|
2021-06-20 00:12:59 +00:00
|
|
|
run: npm ci
|
2019-11-19 17:15:08 +00:00
|
|
|
- working-directory: ./web
|
|
|
|
run: npm test
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27
|
|
|
|
# mirrored above and at https://github.com/mitmproxy/mitmproxy/settings/actions
|
2020-04-08 18:29:07 +00:00
|
|
|
with:
|
|
|
|
file: ./web/coverage/coverage-final.json
|
|
|
|
name: web
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
docs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-12-05 23:04:45 +00:00
|
|
|
python-version: '3.9'
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: |
|
2021-05-11 09:17:09 +00:00
|
|
|
wget -q https://github.com/gohugoio/hugo/releases/download/v0.83.1/hugo_extended_0.83.1_Linux-64bit.deb
|
|
|
|
echo "9487ea3b80f8ddd0ba600d42850b96b6a8b0bb9b41bc08cb285635ebbd41328d hugo_extended_0.83.1_Linux-64bit.deb" | sha256sum -c
|
2019-11-19 17:15:08 +00:00
|
|
|
sudo dpkg -i hugo*.deb
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: pip install -e .[dev]
|
|
|
|
- run: ./docs/build.py
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: docs
|
|
|
|
path: docs/public
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
# Separate from everything else because slow.
|
|
|
|
build-and-deploy-docker:
|
2021-07-16 11:35:30 +00:00
|
|
|
if: github.repository == 'mitmproxy/mitmproxy' && (
|
|
|
|
github.ref == 'refs/heads/main' ||
|
|
|
|
github.ref == 'refs/heads/dockertest' ||
|
|
|
|
startsWith(github.ref, 'refs/tags/')
|
|
|
|
)
|
2021-04-15 13:45:52 +00:00
|
|
|
environment: deploy-docker
|
2021-05-11 09:17:09 +00:00
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
- test-web-ui
|
|
|
|
- build
|
|
|
|
- docs
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
CI_BUILD_DOCKER: 1
|
|
|
|
DOCKER_USERNAME: mitmbot
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-12-05 23:04:45 +00:00
|
|
|
python-version: '3.9'
|
2020-07-27 16:06:55 +00:00
|
|
|
- uses: actions/download-artifact@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2021-05-11 09:17:09 +00:00
|
|
|
name: binaries.linux
|
2019-11-19 17:15:08 +00:00
|
|
|
path: release/dist
|
2021-06-15 13:47:50 +00:00
|
|
|
- uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
|
|
|
|
- uses: docker/setup-buildx-action@b1f1f719c7cd5364be7c82e366366da322d01f7c
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: pip install -e .[dev]
|
|
|
|
- run: python release/cibuild.py build
|
|
|
|
- run: python release/cibuild.py upload
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
deploy:
|
2021-05-11 09:17:09 +00:00
|
|
|
# This action has access to our AWS keys, so we are extra careful here.
|
|
|
|
# In particular, we don't blindly `pip install` anything to minimize the risk of supply chain attacks.
|
2019-11-19 17:15:08 +00:00
|
|
|
if: github.repository == 'mitmproxy/mitmproxy' && github.event_name == 'push'
|
2021-04-15 13:45:52 +00:00
|
|
|
environment: deploy
|
2021-05-11 09:17:09 +00:00
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
- test-web-ui
|
|
|
|
- build
|
|
|
|
- docs
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: mitmproxy
|
|
|
|
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
2021-05-11 09:17:09 +00:00
|
|
|
AWS_DEFAULT_REGION: us-west-2
|
2019-11-19 17:15:08 +00:00
|
|
|
steps:
|
2021-05-11 09:17:09 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-12-05 23:04:45 +00:00
|
|
|
python-version: '3.9'
|
2021-05-21 16:00:14 +00:00
|
|
|
- run: sudo apt-get update
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: sudo apt-get install -y twine awscli
|
2020-07-27 16:06:55 +00:00
|
|
|
- uses: actions/download-artifact@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
path: release/dist
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: mv release/dist/docs docs/public
|
2020-07-27 16:06:55 +00:00
|
|
|
# move artifacts from their subfolders into release/dist
|
|
|
|
- run: find release/dist -mindepth 2 -type f -exec mv {} release/dist \;
|
|
|
|
# and then delete the empty folders
|
|
|
|
- run: find release/dist -type d -empty -delete
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: ls release/dist
|
2021-05-11 09:17:09 +00:00
|
|
|
- run: ./release/deploy.py
|