Configured macOS environment for arm64 architecture

This commit is contained in:
olszomal 2024-11-04 15:21:16 +01:00 committed by Michał Trojnara
parent dc827b94e5
commit de983e680f

View File

@ -34,7 +34,7 @@ jobs:
generator: Unix Makefiles generator: Unix Makefiles
vcpkg_root: vcpkg_root:
- id: macOS - id: macOS
triplet: x64-osx triplet: arm64-osx
compiler: clang compiler: clang
os: macOS-latest os: macOS-latest
generator: Unix Makefiles generator: Unix Makefiles
@ -114,10 +114,17 @@ jobs:
sudo apt-get remove needrestart || echo Ignored sudo apt-get remove needrestart || echo Ignored
sudo apt-get install -y libssl-dev zlib1g-dev python3-cryptography sudo apt-get install -y libssl-dev zlib1g-dev python3-cryptography
- name: Set up Python (macOS)
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: '3.13'
architecture: 'arm64'
- name: Set up Python virtual environment (macOS) - name: Set up Python virtual environment (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
python -m venv venv python -m venv --system-site-packages --copies venv
echo "VIRTUAL_ENV=${{github.workspace}}/venv" >> $GITHUB_ENV echo "VIRTUAL_ENV=${{github.workspace}}/venv" >> $GITHUB_ENV
echo "${{github.workspace}}/venv/bin" >> $GITHUB_PATH echo "${{github.workspace}}/venv/bin" >> $GITHUB_PATH
@ -131,13 +138,24 @@ jobs:
if: runner.os == 'macOS' if: runner.os == 'macOS'
uses: jwlawson/actions-setup-cmake@v2.0 uses: jwlawson/actions-setup-cmake@v2.0
with: with:
cmake-version: '3.17.0' cmake-version: '3.20.0'
- name: Install python3 cryptography module (macOS) - name: Install python3 cryptography module (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
pip install --upgrade pip source venv/bin/activate
pip install cryptography python -m pip install --upgrade pip
ARCHFLAGS="-arch arm64" python -m pip install --no-binary :all: cryptography
python -c "import sys; print(sys.executable)"
python --version
python -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"
- name: Install python3 cryptography module (Windows)
if: runner.os == 'Windows'
run: |
python.exe -m ensurepip
python.exe -m pip install --upgrade pip
python.exe -m pip install cryptography
- name: Find the latest version of Python (Windows) - name: Find the latest version of Python (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -156,19 +174,25 @@ jobs:
exit 1 exit 1
} }
- name: Install python3 cryptography module (Windows) - name: Configure CMake (macOS)
if: runner.os == 'Windows' if: runner.os == 'macOS'
run: | run: |
python.exe -m ensurepip source venv/bin/activate
python.exe -m pip install --upgrade pip cmake \
python.exe -m pip install cryptography -G "${{ matrix.generator }}" \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/dist" \
-DPython3_EXECUTABLE="${{ github.workspace }}/venv/bin/python"
- name: Configure CMake - name: Configure CMake (non-macOS)
if: runner.os != 'macOS'
run: cmake run: cmake
-G "${{matrix.generator}}" -G "${{matrix.generator}}"
-S ${{github.workspace}} -S ${{github.workspace}}
-B ${{github.workspace}}/build -B ${{github.workspace}}/build
-DCMAKE_OSX_ARCHITECTURES=arm64
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist
-DVCPKG_TARGET_TRIPLET=${{matrix.triplet}} -DVCPKG_TARGET_TRIPLET=${{matrix.triplet}}
@ -178,14 +202,6 @@ jobs:
--build ${{github.workspace}}/build --build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}
- name: Show python version (macOS)
working-directory: ${{github.workspace}}/build
if: runner.os == 'macOS'
run: |
python --version
python -c "import sys; print(sys.executable)"
python -c "import cryptography; print(f'Python3 cryptography version {cryptography.__version__}')"
- name: List files (Linux/macOS) - name: List files (Linux/macOS)
if: runner.os != 'Windows' if: runner.os != 'Windows'
run: find .. -ls run: find .. -ls
@ -194,7 +210,15 @@ jobs:
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: Get-ChildItem -Recurse -Name .. run: Get-ChildItem -Recurse -Name ..
- name: Test - name: Test (macOS)
if: runner.os == 'macOS'
working-directory: ${{github.workspace}}/build
run: |
source ../venv/bin/activate
ctest -C ${{env.BUILD_TYPE}}
- name: Test (non-macOS)
if: runner.os != 'macOS'
working-directory: ${{github.workspace}}/build working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} run: ctest -C ${{env.BUILD_TYPE}}