Skip to content

Commit

Permalink
Automatically trigger a test mypyc build on master commits (python#5672)
Browse files Browse the repository at this point in the history
We want to automatically build mypyc-compiled mypy wheels for mypy master commits.
To do this, we use a separate github repo that has mypy and mypyc as submodules and
which automatically builds wheel images and uploads them as github release artifacts.

Currently, for testing purposes, the target repo is https://github.com/msullivan/travis-testing.
Obviously this will need to be something else later.
The push is done as the `mypy-build-bot` github user, and I configured travis with an API token for that account as the `$WHEELS_PUSH_TOKEN` environment variable.
  • Loading branch information
msullivan authored Sep 26, 2018
1 parent 8df6adc commit 83820a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
env:
- TOXENV=lint
- EXTRA_ARGS=
- name: "trigger a build of wheels"
stage: deploy
python: 3.7
script: if [[ $TRAVIS_BRANCH = "master" && $TRAVIS_PULL_REQUEST = "false" ]]; then ./misc/trigger_wheel_build.sh; fi

install:
- pip install -U pip setuptools
Expand Down
24 changes: 24 additions & 0 deletions misc/trigger_wheel_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -eux

# Trigger a build of mypyc compiled mypy wheels by updating the mypy
# submodule in the git repo that drives those builds.

# TODO: This is a testing repo and will need to be retargeted at the
# real location once it exists. $WHEELS_PUSH_TOKEN is stored in travis
# and is an API token for the mypy-build-bot account.
git clone --recurse-submodules https://${WHEELS_PUSH_TOKEN}@github.com/msullivan/travis-testing.git build

git config --global user.email "nobody"
git config --global user.name "mypy wheels autopush"

COMMIT=$(git rev-parse HEAD)
cd build/mypy
git fetch
git checkout $COMMIT
pip install -r test-requirements.txt
V=$(python3 -m mypy --version)
V=$(echo "$V" | cut -d" " -f2)
cd ..
git commit -am "Build wheels for mypy $V"
git tag v$V
git push --tags origin master

0 comments on commit 83820a0

Please sign in to comment.