Skip to content

Commit

Permalink
Cirrus deploy wheels (#4150)
Browse files Browse the repository at this point in the history
* A start

* it's 10 pm, why are you reading this?

* never gonna give you up (package dir)

* Almost definitely going to let you down

* real tokens this time around

* fix linux image to use docker

* check why wheel upload task isn't being triggered

* _task is a protected string

* Try something stupid

* wheels go in the house

* bash is a horrible language

* fix release tag check

* switch image type

* yes yes bash, have your fi

* use pipx run method

* somehow that if statement is getting triggered

* fix if/else branch

* complete the circle

* remove block on arm64 dependency

* clean up cirrus.star

* fix star file

* why is there no trigger?

* Add return statements

* update changelog
  • Loading branch information
IAlibay authored May 27, 2023
1 parent eba3633 commit 646adf1
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .cirrus.star
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ load("cirrus", "env", "fs")

def main(ctx):
# Default case: don't do anything if not in the core repo
# or if you're not targetting the develop branch
if ((env.get("CIRRUS_REPO_FULL_NAME") != "MDAnalysis/mdanalysis")
or (env.get("CIRRUS_BASE_BRANCH") != "develop")):
if env.get("CIRRUS_REPO_FULL_NAME") != "MDAnalysis/mdanalysis":
return []

return fs.read("maintainer/ci/cirrus-ci.yml")
# Some debugging to know what state you are in, by default everything is None but PR
print(env.get("CIRRUS_TAG") == None)
print(env.get("CIRRUS_RELEASE") == None)
print(env.get("CIRRUS_PR") != None)
print(env.get("CIRRUS_BASE_BRANCH") == "develop")

# If you're targetting develop and it's a PR, run a CI job
if ((env.get("CIRRUS_BASE_BRANCH") == "develop") and (env.get("CIRRUS_PR") != None)):
return fs.read("maintainer/ci/cirrus-ci.yml")

# If you've tagged a package or released something, deploy
if ((env.get("CIRRUS_TAG") != None) or (env.get("CIRRUS_RELEASE") != None)):
return fs.read("maintainer/ci/cirrus-deploy.yml")

return []
79 changes: 79 additions & 0 deletions maintainer/ci/cirrus-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
build_and_store_wheels: &BUILD_AND_STORE_WHEELS
install_cibuildwheel_script:
- python -m pip install cibuildwheel==2.12.3
run_cibuildwheel_script:
- cibuildwheel ./package
wheels_artifacts:
path: "wheelhouse/*"


linux_aarch64_wheel_task:
compute_engine_instance:
image_project: cirrus-images
image: family/docker-builder-arm64
architecture: arm64
platform: linux
cpu: 4
memory: 4G
env:
CIBW_BUILD: cp39-manylinux* cp310-manylinux* cp311-manylinux*

build_script: |
apt install -y python3-venv python-is-python3
python3 --version
python --version
<<: *BUILD_AND_STORE_WHEELS


macos_arm64_wheel_task:
macos_instance:
image: ghcr.io/cirruslabs/macos-monterey-xcode:14
env:
CIBW_BUILD: cp39-* cp310-* cp311-*
PATH: /opt/homebrew/opt/[email protected]/bin:$PATH

build_script: |
brew install [email protected]
ln -s python3 /opt/homebrew/opt/[email protected]/bin/python
python --version
python3 --version
<<: *BUILD_AND_STORE_WHEELS


wheel_upload_task:
depends_on:
- macos_arm64_wheel
- linux_aarch64_wheel
compute_engine_instance:
image_project: cirrus-images
image: family/docker-builder
platform: linux
env:
TESTPYPI: ENCRYPTED[!adb082e719dbf71b700796a3f6969d1ca8ba69879cbf8ce4e969285b2ccd0212a54afea897c8d55174bd18388b22fd7a!]
PYPI: ENCRYPTED[!35e6711ac1b0f6ff790a2743db2e02c9efc07a49865252c53f9482c71609946746eb7d05fa75a13c094c9692f4d869d4!]
uploady_script: |
curl https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/wheels.zip --output wheels.zip
unzip wheels.zip
ls *
ls wheelhouse
apt install -y python3-venv python-is-python3
python --version
python3 --version
python -m pip install pipx
export TWINE_USERNAME="__token__"
echo $CIRRUS_RELEASE
echo $CIRRUS_TAG
if [ ! -z "$CIRRUS_RELEASE" ]; then
echo "RELEASE INCOMING!"
export TWINE_PASSWORD=$PYPI
pipx run twine upload -r pypi wheelhouse/* --non-interactive
elif [[ $CIRRUS_TAG == "package-"* ]]; then
echo "Let's get this tested!"
export TWINE_PASSWORD=$TESTPYPI
pipx run twine upload -r testpypi wheelhouse/* --non-interactive
else
echo "Nothing to see here I'm afraid"
fi
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Fixes
(Issue #3336)

Enhancements
* ARM64 (osx and linux) wheels now uploaded on release (Issue #4054)
* Add simple atomic distance analysis to `analysis.atomicdistances` with
new class `AtomicDistances` (Issue #3654)
* Add kwarg `n_frames` to class method `empty()` in
Expand Down

0 comments on commit 646adf1

Please sign in to comment.