lower msrv (#114) #721
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
rust: "1.70" # MSRV | |
args: --exclude macos-certificate-truster | |
- os: macos-latest | |
rust: "1.70" | |
args: --exclude windows-redirector | |
- os: ubuntu-latest | |
rust: stable | |
args: --exclude windows-redirector --exclude macos-certificate-truster | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Rust toolchain | |
run: rustup toolchain install ${{ matrix.rust }} --profile minimal | |
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # v2.6.2 | |
timeout-minutes: 2 | |
continue-on-error: true | |
# PyO3 wants recent Python on Windows. | |
- uses: actions/setup-python@v4 | |
with: | |
python-version-file: .github/python-version.txt | |
- name: Run "cargo check" | |
# the action-rs/cargo action adds inline annotations for "cargo check" output | |
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72 | |
with: | |
toolchain: ${{ matrix.rust }} | |
command: check | |
args: --workspace --verbose ${{ matrix.args }} | |
- name: Run "cargo test" | |
# the action-rs/cargo action adds inline annotations for "cargo test" output | |
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72 | |
with: | |
toolchain: ${{ matrix.rust }} | |
command: test | |
args: --workspace --verbose ${{ matrix.args }} | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
- os: ubuntu-latest | |
args: --compatibility manylinux2014 --zig --sdist | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
args: --compatibility manylinux2014 --zig --target aarch64-unknown-linux-gnu | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
args: --target universal2-apple-darwin | |
runs-on: ${{ matrix.os }} | |
name: build mitmproxy-rs (${{ matrix.os }}, ${{ matrix.target || 'x64' }}) | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup toolchain install stable --profile minimal | |
- run: rustup default stable | |
- if: matrix.target | |
run: rustup target add ${{ matrix.target }} | |
- run: rustup show | |
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # v2.6.2 | |
timeout-minutes: 2 | |
continue-on-error: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version-file: .github/python-version.txt | |
- if: runner.os == 'Linux' | |
name: Install maturin[zig] from PyPI | |
uses: install-pinned/maturin-with-zig@930de5c8284dfb26f11fd30a35a0df4c15ee4f8b | |
- if: runner.os != 'Linux' | |
name: Install maturin from PyPI | |
uses: install-pinned/maturin@4fd3810fa566280146c1de9a0b166cdf7748155d | |
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: python .github/scripts/pin-versions.py | |
- run: maturin build --release ${{ matrix.args }} | |
working-directory: ./mitmproxy-rs | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: target/wheels | |
build-macos-app: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache-app | |
with: | |
path: mitmproxy-macos/redirector/dist/ | |
key: macos-${{ hashFiles('mitmproxy-macos/redirector/**', '.github/scripts/build-macos-redirector.sh') }} | |
- if: steps.cache-app.outputs.cache-hit != 'true' | |
run: $GITHUB_WORKSPACE/.github/scripts/build-macos-redirector.sh | |
working-directory: mitmproxy-macos/redirector | |
env: | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} | |
APPLE_PROVISIONING_PROFILE_APP: ${{ secrets.APPLE_PROVISIONING_PROFILE_APP }} | |
APPLE_PROVISIONING_PROFILE_EXT: ${{ secrets.APPLE_PROVISIONING_PROFILE_EXT }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: macos-app | |
path: mitmproxy-macos/redirector/dist/ | |
build-os-wheels: | |
needs: build-macos-app | |
strategy: | |
matrix: | |
include: | |
- os: windows | |
build-rust: --package windows-redirector | |
- os: macos | |
build-rust: --package macos-certificate-truster | |
runs-on: ${{ matrix.os }}-latest | |
name: build mitmproxy-${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Build Rust | |
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # v2.6.2 | |
timeout-minutes: 2 | |
continue-on-error: true | |
- run: rustup toolchain install stable --profile minimal | |
- run: rustup default stable | |
- run: cargo build --release ${{ matrix.build-rust }} | |
# Download macOS app | |
- if: runner.os == 'macOS' | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos-app | |
path: mitmproxy-macos/redirector/dist/ | |
# Build & upload wheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version-file: .github/python-version.txt | |
- name: Install build from PyPI | |
uses: install-pinned/build@11bbf2deeb1a44228c45910f3b57e346927960b4 | |
- run: python -m build --wheel ./mitmproxy-${{ matrix.os }} --outdir target/wheels/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: target/wheels | |
check: | |
if: always() | |
needs: | |
- test | |
- build | |
- build-os-wheels | |
uses: mhils/workflows/.github/workflows/alls-green.yml@main | |
with: | |
jobs: ${{ toJSON(needs) }} | |
deploy: | |
uses: mhils/workflows/.github/workflows/python-deploy.yml@main | |
needs: check | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
with: | |
artifact: wheels | |
# repository: testpypi | |
# environment: deploy-testpypi | |
secrets: | |
password: ${{ secrets.PYPI_TOKEN }} |