Fix #910: Use python venv for macOS build

With this commit macOS build starts using Python virtual environment so
that our build steps can comply with PEP 668 [1].

This is only about the build procedure. There must be no behavior change
in the build artifacts.

#codehealth

 [1]: https://peps.python.org/pep-0668/

PiperOrigin-RevId: 621123606
This commit is contained in:
Yohei Yukawa
2024-04-02 10:59:27 +00:00
committed by Hiroyuki Komatsu
parent 9c5fc40cba
commit e8d25a2bee
3 changed files with 49 additions and 12 deletions

View File

@ -11,6 +11,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
PYTHON_VENV_ROOT: ${{ github.workspace }}/src/python-venv
jobs:
build_arm64:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-14-Readme.md
@ -23,9 +26,10 @@ jobs:
with:
submodules: 'recursive'
- name: Install pip dependencies
working-directory: ./src
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
@ -38,11 +42,13 @@ jobs:
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: Build Qt
working-directory: ./src
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/build_qt.py --release --confirm_license --macos_cpus=arm64
echo "MOZC_QT_PATH=${PWD}/third_party/qt" >> $GITHUB_ENV
@ -69,9 +75,10 @@ jobs:
with:
submodules: 'recursive'
- name: Install pip dependencies
working-directory: ./src
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
@ -84,11 +91,13 @@ jobs:
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: Build Qt
working-directory: ./src
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/build_qt.py --release --confirm_license --macos_cpus=x86_64
echo "MOZC_QT_PATH=${PWD}/third_party/qt" >> $GITHUB_ENV
@ -115,9 +124,10 @@ jobs:
with:
submodules: 'recursive'
- name: Install pip dependencies
working-directory: ./src
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
@ -130,11 +140,13 @@ jobs:
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: Build Qt
working-directory: ./src
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/build_qt.py --release --confirm_license --macos_cpus=x86_64,arm64
echo "MOZC_QT_PATH=${PWD}/third_party/qt" >> $GITHUB_ENV
@ -161,9 +173,10 @@ jobs:
with:
submodules: 'recursive'
- name: Install pip dependencies
working-directory: ./src
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
@ -176,11 +189,13 @@ jobs:
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: Build Qt
working-directory: ./src
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/build_qt.py --release --confirm_license
echo "MOZC_QT_PATH=${PWD}/third_party/qt" >> $GITHUB_ENV
@ -201,9 +216,10 @@ jobs:
- name: checkout
uses: actions/checkout@v4
- name: Install pip dependencies
working-directory: ./src
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
@ -216,4 +232,5 @@ jobs:
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py --cache_only