2019-11-19 17:15:08 +00:00
|
|
|
name: CI
|
|
|
|
|
2019-12-16 02:00:26 +00:00
|
|
|
on: [push, pull_request]
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint-pr:
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: TrueBrain/actions-flake8@v1.2
|
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:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
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:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
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:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
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:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
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:
|
|
|
|
- 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
|
|
|
|
- os: ubuntu-latest
|
|
|
|
py: 3.7
|
|
|
|
- os: ubuntu-latest
|
|
|
|
py: 3.6
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- run: printenv
|
|
|
|
- uses: actions/checkout@v1
|
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
|
2020-04-08 18:29:07 +00:00
|
|
|
- uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
file: ./coverage.xml
|
|
|
|
name: ${{ matrix.os }}
|
2020-07-27 16:06:55 +00:00
|
|
|
test-unsupported-python-version:
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.5'
|
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e py35
|
|
|
|
build-wheel:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
CI_BUILD_WHEEL: 1
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-04-03 16:26:38 +00:00
|
|
|
python-version: '3.8'
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e cibuild -- build
|
2020-07-27 16:06:55 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
name: wheel
|
|
|
|
path: release/dist
|
|
|
|
build-binaries:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
# Old Ubuntu version for old glibc
|
2020-07-27 16:06:55 +00:00
|
|
|
os: [macos-10.15, windows-2019, ubuntu-16.04]
|
2019-11-19 17:15:08 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
|
|
CI_BUILD_PYINSTALLER: 1
|
2020-11-02 01:19:02 +00:00
|
|
|
CI_BUILD_WININSTALLER: ${{ matrix.os == 'windows-2019' }}
|
2019-11-19 17:15:08 +00:00
|
|
|
CI_BUILD_KEY: ${{ secrets.CI_BUILD_KEY }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
|
|
|
- if: matrix.os == 'windows-latest'
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: release/installbuilder/setup
|
|
|
|
key: installbuilder
|
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e cibuild -- build
|
|
|
|
# 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:
|
|
|
|
name: binaries.${{ matrix.os }}
|
|
|
|
path: release/dist
|
|
|
|
|
|
|
|
test-web-ui:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- run: git rev-parse --abbrev-ref HEAD
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
- id: yarn-cache
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
- working-directory: ./web
|
|
|
|
run: yarn
|
|
|
|
- working-directory: ./web
|
|
|
|
run: npm test
|
2020-04-08 18:29:07 +00:00
|
|
|
- uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
file: ./web/coverage/coverage-final.json
|
|
|
|
name: web
|
2019-11-19 17:15:08 +00:00
|
|
|
|
|
|
|
docs:
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-04-03 16:26:38 +00:00
|
|
|
python-version: '3.8'
|
2019-11-19 17:15:08 +00:00
|
|
|
- run: pip install tox
|
|
|
|
- run: |
|
2020-05-16 15:10:44 +00:00
|
|
|
wget https://github.com/gohugoio/hugo/releases/download/v0.70.0/hugo_extended_0.70.0_Linux-64bit.deb
|
2019-11-19 17:15:08 +00:00
|
|
|
sudo dpkg -i hugo*.deb
|
|
|
|
- run: tox -e docs
|
|
|
|
|
|
|
|
# Separate from everything else because slow.
|
|
|
|
build-and-deploy-docker:
|
|
|
|
if: github.repository == 'mitmproxy/mitmproxy' && github.event_name == 'push'
|
|
|
|
needs: [test, test-web-ui, build-wheel]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
CI_BUILD_DOCKER: 1
|
|
|
|
DOCKER_USERNAME: mitmbot
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.7'
|
|
|
|
- run: pip install tox
|
2020-07-27 16:06:55 +00:00
|
|
|
- uses: actions/download-artifact@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
|
|
|
name: wheel
|
|
|
|
path: release/dist
|
|
|
|
- run: tox -e cibuild -- build
|
|
|
|
- run: tox -e cibuild -- upload
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
if: github.repository == 'mitmproxy/mitmproxy' && github.event_name == 'push'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [test, test-web-ui, build-wheel, build-binaries]
|
|
|
|
env:
|
|
|
|
CI_BUILD_WHEEL: 1
|
|
|
|
CI_BUILD_PYINSTALLER: 1
|
|
|
|
CI_BUILD_WININSTALLER: 1
|
|
|
|
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 }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-26 21:54:35 +00:00
|
|
|
- uses: actions/setup-python@v2
|
2019-11-19 17:15:08 +00:00
|
|
|
with:
|
2020-04-03 16:26:38 +00:00
|
|
|
python-version: '3.8'
|
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
|
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
|
|
|
|
- run: pip install tox
|
|
|
|
- run: tox -e cibuild -- upload
|