LinuxRelease_aarch64 #9
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: LinuxRelease_aarch64 | |
on: | |
schedule: | |
# Run weekly on Monday 00:00 | |
- cron: '00 00 * * MON' | |
push: | |
branches: [main, rel-*] | |
pull_request: | |
branches: [main, rel-*] | |
workflow_dispatch: | |
jobs: | |
build: | |
if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# the different python versions for building wheels | |
python-version: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311] | |
env: | |
# setting up python and docker image | |
py: /opt/python/${{ matrix.python-version }}/bin/python | |
img: quay.io/pypa/manylinux2014_aarch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Checkout submodules | |
shell: bash | |
run: | | |
auth_header="$(git config --local --get http.https://github.com/.extraheader)" | |
git submodule sync --recursive | |
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 | |
# setting up qemu for enabling aarch64 binary execution on x86 machine | |
- uses: docker/setup-qemu-action@v1 | |
with: | |
# TODO: freeze version for now since the latest one cannot use jupyter | |
image: tonistiigi/binfmt:qemu-v6.0.0-12 | |
# Creating a virtual environment on machine with the help of docker container \ | |
# and installing the dependencies inside that \ | |
# so that we can use installed dependencies. | |
- name: Install dependencies | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '${{ env.py }} -m pip install -q virtualenv && ${{ env.py }} -m venv .env && \ | |
source .env/bin/activate && \ | |
${{ env.py }} -m pip install -q -r requirements-release.txt && \ | |
yum install -y protobuf-compiler protobuf-devel | |
deactivate' | |
# using created virtual environment in new container and executing the script | |
- name: Build manylinux2014_aarch64 | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '\ | |
source .env/bin/activate && \ | |
yum install -y sudo && \ | |
sudo chmod +x .github/workflows/manylinux/entrypoint.sh && \ | |
sudo .github/workflows/manylinux/entrypoint.sh ${{ env.py }} manylinux2014_aarch64 ${{ github.event_name }} | |
deactivate' | |
# using created virtual environment in new container and testing the wheel | |
- name: Test wheel with Python ${{ matrix.python-version }} | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '\ | |
source .env/bin/activate && \ | |
python -m pip install -q --upgrade pip && \ | |
python -m pip install -q -r requirements-release.txt && \ | |
pip install dist/*manylinux2014_aarch64.whl && \ | |
pytest && \ | |
deactivate' | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: wheels | |
path: dist | |
- name: Upload wheel to TestPyPI weekly | |
if: (github.event_name == 'schedule') # Only triggered by weekly event | |
run: | | |
python -m pip install -q twine | |
twine upload --verbose dist/*.whl --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.TESTPYPI_USERNAME }} -p ${{ secrets.TESTPYPI_PASSWORD }} | |
- name: Verify ONNX with the latest numpy and protobuf | |
if: ${{ always() }} | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '\ | |
source .env/bin/activate && \ | |
python -m pip uninstall -y numpy onnx protobuf && python -m pip install numpy protobuf && \ | |
python -m pip install dist/*manylinux2014_aarch64.whl && \ | |
pytest && \ | |
deactivate' | |
- name: Verify ONNX with the minimum supported protobuf (from requirements.txt) | |
if: ${{ always() }} | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '\ | |
source .env/bin/activate && \ | |
python -m pip uninstall -y onnx && python -m pip install protobuf==3.20.2 && \ | |
python -m pip install dist/*manylinux2014_aarch64.whl && \ | |
pytest && \ | |
deactivate' | |
- name: Verify ONNX with ONNX Runtime PyPI package | |
if: matrix.python-version != 'cp311-cp311' | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '\ | |
source .env/bin/activate && \ | |
python -m pip install -q onnxruntime && \ | |
python onnx/test/test_with_ort.py && \ | |
deactivate' |