-
Notifications
You must be signed in to change notification settings - Fork 169
modify release-build for linux and macosx #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PabloCarmona
wants to merge
28
commits into
master
Choose a base branch
from
cicd-linux-macosx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
db49834
modify release-build for linux and macosx
4173ff4
change to pipx for macos setup
bd3eeac
change macosx to use pypa/cibuildwheel action and add --no-cache-dir …
PabloCarmona bf034ba
fix vars for macos build
PabloCarmona 287ce56
fix and add proper x86 arch
PabloCarmona f92ccbf
put proper torch version
PabloCarmona 0837600
remove unnecessary matrix
PabloCarmona e9c4582
add step for setup openblas on macos build
PabloCarmona 0f3311d
change manylinux build
PabloCarmona 396f830
add clean, prune and cache tasks to help optimize disk space on runnners
PabloCarmona 55ead00
clean some jobs not necessary
PabloCarmona 14d5460
add compatible macosx version
PabloCarmona 075cd23
disk optimization
PabloCarmona 2933d28
update pyproject.toml and modify release-build
PabloCarmona dbb5389
change versions for build
PabloCarmona 29f20d2
move from aws to ibmcloud cos publish
PabloCarmona 7846641
fix pyproject.toml syntax error
PabloCarmona db4d584
fix pyproject.toml syntax error
PabloCarmona 4bbbc2f
remove backend path
PabloCarmona 0dd5a58
fix pyproject.toml syntax error
PabloCarmona 3125e45
bump macosx target version from 10.9 to 10.13
PabloCarmona c71c8fd
fix pyproject.toml typo errpr
PabloCarmona b76da3f
add multiple python version
PabloCarmona 3697142
fix naming version for macosx builds
PabloCarmona 11b76a7
add cicd status badge to README
PabloCarmona beb9cd0
fix problem with Pytorch versions
f77f7ef
add fix to release-build workflow
PabloCarmona a324766
fix lint for naming
PabloCarmona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,233 +2,126 @@ name: release-build | |
|
||
on: | ||
workflow_dispatch: | ||
create: | ||
tags: 'v**' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
COS_ACCESS_KEY_ID: ${{ secrets.COS_ACCESS_KEY_ID }} | ||
COS_SECRET_ACCESS_KEY: ${{ secrets.COS_SECRET_ACCESS_KEY }} | ||
COS_BUCKET: ${{ secrets.COS_BUCKET }} | ||
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT }} | ||
IBM_CLOUD_REGION: ${{ secrets.IBM_CLOUD_REGION }} | ||
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }} | ||
IBM_CLOUD_RESOURCE_GROUP: ${{ secrets.IBM_CLOUD_RESOURCE_GROUP }} | ||
COS_BUCKET: ${{ secrets.COS_BUCKET }} | ||
|
||
jobs: | ||
# ──────────────────────────── | ||
# Test on Python 3.10 | ||
# Stage: Build & Deploy Wheels | ||
# ──────────────────────────── | ||
test-py310: | ||
name: Test (Python 3.10) | ||
build-and-deploy-linux: | ||
name: Build & Deploy wheels (manylinux) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
- uses: actions/cache@v4 | ||
with: | ||
python-version: 3.10.17 | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get install -y ca-certificates libopenblas-dev gcc-9 g++-9 | ||
sudo update-alternatives \ | ||
--install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \ | ||
--slave /usr/bin/g++ g++ /usr/bin/g++-9 | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
|
||
- name: Build and install aihwkit wheel | ||
- name: Cleanup runner | ||
run: | | ||
pip install -r requirements.txt | ||
make build_inplace | ||
pip cache purge | ||
sudo apt-get clean | ||
sudo rm -rf /var/lib/apt/lists/* | ||
|
||
- name: Run pytest | ||
run: | | ||
pip install -r requirements-dev.txt | ||
make pytest | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
TEST_DATASET: true | ||
|
||
# ──────────────────────────── | ||
# Lint on Python 3.10 | ||
# ──────────────────────────── | ||
lint-py310: | ||
name: Lint (Python 3.10) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
CIBW_ENVIRONMENT: "TORCH_VERSION_SPECIFIER='==2.3.1' MAKEFLAGS='-j4'" | ||
CIBW_BEFORE_BUILD: "pip install torch==2.3.1 torchvision -f https://download.pytorch.org/whl/torch_stable.html && pip install -r requirements.txt" | ||
CIBW_MANYLINUX_X86_64_IMAGE: "aihwkit/manylinux2014_x86_64_aihwkit" | ||
CIBW_REPAIR_WHEEL_COMMAND: "auditwheel repair -w {dest_dir} {wheel} --exclude libtorch_python.so" | ||
CIBW_BUILD: "cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64" | ||
with: | ||
python-version: 3.10.17 | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get install -y ca-certificates libopenblas-dev gcc-9 g++-9 | ||
sudo update-alternatives \ | ||
--install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \ | ||
--slave /usr/bin/g++ g++ /usr/bin/g++-9 | ||
output-dir: wheelhouse | ||
|
||
- name: Build and install aihwkit wheel | ||
- name: Sync wheels to IBM COS | ||
env: | ||
IBM_CLOUD_REGION: ${{ secrets.IBM_CLOUD_REGION }} | ||
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }} | ||
IBM_CLOUD_RESOURCE_GROUP: ${{ secrets.IBM_CLOUD_RESOURCE_GROUP }} | ||
COS_BUCKET: ${{ secrets.COS_BUCKET }} | ||
run: | | ||
pip install -r requirements.txt | ||
make build_inplace | ||
|
||
- name: Run lint checks | ||
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh | ||
ibmcloud plugin install cos | ||
ibmcloud login --apikey "$IBM_CLOUD_API_KEY" -r "$IBM_CLOUD_REGION" -g "$IBM_CLOUD_RESOURCE_GROUP" | ||
find "wheelhouse" -type f | while read filepath; do | ||
relpath="${filepath#wheelhouse/}" | ||
dest="$relpath" | ||
echo "Uploading $filepath to $dest" | ||
ibmcloud cos upload \ | ||
--bucket "$COS_BUCKET" \ | ||
--key "$dest" \ | ||
--file "$filepath" \ | ||
--region "$IBM_CLOUD_REGION" | ||
done | ||
|
||
- name: Cleanup runner | ||
if: always() | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install -r requirements-examples.txt | ||
make pycodestyle | ||
make pylint | ||
make mypy | ||
# ──────────────────────────────────────── | ||
# Stage: Test multiple Python versions | ||
# ──────────────────────────────────────── | ||
test-matrix: | ||
name: Tests (3.8 & 3.9) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9] | ||
pip cache purge | ||
sudo apt-get clean | ||
sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
rm -rf wheelhouse build dist *.egg-info | ||
|
||
build-and-deploy-macos: | ||
name: Build & Deploy wheels (macOS) | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
- uses: actions/cache@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install system deps | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get install -y ca-certificates libopenblas-dev gcc-9 g++-9 | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \ | ||
--slave /usr/bin/g++ g++ /usr/bin/g++-9 | ||
|
||
- name: Build and install aihwkit wheel | ||
run: | | ||
pip install -r requirements.txt | ||
make build_inplace | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
|
||
- name: Run pytest | ||
- name: Set up Environment | ||
run: | | ||
pip install -r requirements-dev.txt | ||
make pytest | ||
|
||
# ──────────────────────────── | ||
# Stage: Build & Deploy Wheels | ||
# ──────────────────────────── | ||
build-and-deploy-linux: | ||
name: Build & Deploy wheels (manylinux) | ||
runs-on: ubuntu-latest | ||
services: | ||
docker: | ||
image: docker:20.10.16 | ||
options: --privileged | ||
env: | ||
CIBW_ENVIRONMENT: "TORCH_VERSION_SPECIFIER='==2.3.1+cu121'" | ||
CIBW_BEFORE_BUILD: "pip install torch==2.3.1+cu121 torchvision -f https://download.pytorch.org/whl/torch_stable.html && pip install -r requirements.txt" | ||
CIBW_MANYLINUX_X86_64_IMAGE: "aihwkit/manylinux2014_x86_64_aihwkit_cuda" | ||
CIBW_REPAIR_WHEEL_COMMAND: "auditwheel repair -w {dest_dir} {wheel} --exclude libtorch_python.so" | ||
CIBW_BUILD: "cp39-manylinux_x86_64 cp310-manylinux_x86_64" | ||
AIHWKIT_VERSION_SUFFIX: "+cuda121" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Pull manylinux image | ||
run: docker pull $CIBW_MANYLINUX_X86_64_IMAGE | ||
|
||
- name: Install cibuildwheel | ||
run: python3 -m pip install cibuildwheel==2.23.3 | ||
brew install openblas | ||
brew link --force openblas | ||
git clone -b aihwkit https://github.com/aihwkit-bot/delocate.git | ||
|
||
- name: Build wheels | ||
run: python3 -m cibuildwheel --output-dir wheelhouse | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ENVIRONMENT: "TORCH_VERSION_SPECIFIER='==2.3.1'" | ||
CIBW_BEFORE_BUILD: "pip install torch==2.3.1 torchvision -f https://download.pytorch.org/whl/torch_stable.html && pip install ./delocate && pip install -r requirements.txt" | ||
CIBW_ARCHS: "x86_64" | ||
CIBW_BUILD: "cp38-macosx_x86_64 cp39-macosx_x86_64 cp310-macosx_x86_64" | ||
MACOSX_DEPLOYMENT_TARGET: "10.13" | ||
with: | ||
output-dir: wheelhouse | ||
|
||
- name: Sync wheels to IBM COS | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.COS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.COS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: us-south-1 | ||
IBM_CLOUD_REGION: ${{ secrets.IBM_CLOUD_REGION }} | ||
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }} | ||
IBM_CLOUD_RESOURCE_GROUP: ${{ secrets.IBM_CLOUD_RESOURCE_GROUP }} | ||
COS_BUCKET: ${{ secrets.COS_BUCKET }} | ||
run: | | ||
which aws || pip install awscli --upgrade | ||
aws s3 sync wheelhouse/ s3://${{ env.COS_BUCKET }}/ \ | ||
--acl public-read \ | ||
--delete \ | ||
--endpoint-url https://${{ env.COS_ENDPOINT }} | ||
|
||
# build-and-deploy-macos: | ||
# name: Build & Deploy wheels (macOS) | ||
# runs-on: macos-latest | ||
# env: | ||
# CIBW_ENVIRONMENT: "TORCH_VERSION_SPECIFIER='==2.0.1'" | ||
# CIBW_BEFORE_BUILD: "pip install torch==2.0.1 torchvision && pip install ./delocate && pip install -r requirements.txt" | ||
# CIBW_BUILD: "cp38-macosx_x86_64 cp39-macosx_x86_64" | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
|
||
# - name: Install Homebrew deps | ||
# run: | | ||
# brew update | ||
# brew install openblas | ||
|
||
# - name: Clone delocate | ||
# run: git clone -b aihwkit https://github.com/aihwkit-bot/delocate.git | ||
|
||
# - name: Install cibuildwheel | ||
# run: python3 -m pip install cibuildwheel==2.8.1 | ||
|
||
# - name: Build wheels | ||
# run: python3 -m cibuildwheel --output-dir wheelhouse --platform macos | ||
|
||
# - name: Sync wheels to IBM COS | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.COS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.COS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: us-south-1 | ||
# run: | | ||
# which aws || pip install awscli --upgrade | ||
# aws s3 sync wheelhouse/ s3://${{ env.COS_BUCKET }}/ \ | ||
# --acl public-read \ | ||
# --delete \ | ||
# --endpoint-url https://${{ env.COS_ENDPOINT }} | ||
|
||
# build-and-deploy-windows: | ||
# name: Build & Deploy wheels (Windows) | ||
# runs-on: windows-latest | ||
# env: | ||
# CIBW_ENVIRONMENT: "TORCH_VERSION_SPECIFIER='==2.4.1'" | ||
# CIBW_BEFORE_BUILD: "pip install torch==2.4.1 && pip install -r requirements.txt" | ||
# CIBW_BUILD: "cp38-win_amd64 cp39-win_amd64 cp310-win_amd64" | ||
# OPENBLAS_ROOT: C:\\BLAS | ||
# OPENBLAS_ROOT_DIR: C:\\BLAS | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
|
||
# - name: Install Python & BLAS | ||
# run: | | ||
# choco install python --version=3.8.6 -y | ||
# SET PATH=C:\Python38;C:\Python38\Scripts;%PATH% | ||
# mkdir C:\BLAS | ||
# Invoke-WebRequest -Uri https://github.com/xianyi/OpenBLAS/releases/download/v0.3.12/OpenBLAS-0.3.12-x64.zip -OutFile openblas.zip | ||
# Expand-Archive openblas.zip -DestinationPath C:\BLAS | ||
|
||
# - name: Install cibuildwheel | ||
# run: python -m pip install cibuildwheel==2.8.1 | ||
|
||
# - name: Build wheels | ||
# run: python -m cibuildwheel --output-dir wheelhouse | ||
|
||
# - name: Sync wheels to IBM COS | ||
# env: | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.COS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.COS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: us-south-1 | ||
# run: | | ||
# which aws || pip install awscli --upgrade | ||
# aws s3 sync wheelhouse/ s3://${{ env.COS_BUCKET }}/ \ | ||
# --acl public-read \ | ||
# --delete \ | ||
# --endpoint-url https://${{ env.COS_ENDPOINT }} | ||
curl -fsSL https://clis.cloud.ibm.com/install/osx | sh | ||
ibmcloud plugin install cos | ||
ibmcloud login --apikey "$IBM_CLOUD_API_KEY" -r "$IBM_CLOUD_REGION" -g "$IBM_CLOUD_RESOURCE_GROUP" | ||
find "wheelhouse" -type f | while read filepath; do | ||
relpath="${filepath#wheelhouse/}" | ||
dest="$relpath" | ||
echo "Uploading $filepath to $dest" | ||
ibmcloud cos upload \ | ||
--bucket "$COS_BUCKET" \ | ||
--key "$dest" \ | ||
--file "$filepath" \ | ||
--region "$IBM_CLOUD_REGION" | ||
done | ||
- name: Cleanup runner | ||
if: always() | ||
run: | | ||
pip cache purge | ||
brew cleanup --prune=all | ||
rm -rf ~/Library/Caches/Homebrew/* | ||
rm -rf wheelhouse build dist *.egg-info |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily for this PR, but we have an official github action for setting up the CLI, logging in and installing plugins.