From 1c14dce31947c2af8c5353466bfcc882731fe231 Mon Sep 17 00:00:00 2001 From: Stefano Lusardi Date: Mon, 19 Aug 2024 10:58:09 +0200 Subject: [PATCH] Update build.yml for Azure Pipelines --- ci/build.yml | 165 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 134 insertions(+), 31 deletions(-) diff --git a/ci/build.yml b/ci/build.yml index e3793f1..f91d2db 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -29,7 +29,7 @@ variables: jobs: - ${{ each BUILD_TYPE in parameters.BUILD_TYPES }}: - - job: '${{BUILD_TYPE}}' + - job: '${{BUILD_TYPE}}_OpenSSL' strategy: matrix: @@ -43,39 +43,142 @@ jobs: ACTIVATE_VIRTUAL_ENV: 'call ".venv\Scripts\activate.bat"' INSTALL_FFMPEG: 'choco install ffmpeg -y' - # Full path to MSVC 2019 build environment setup script: - # https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#visual-studio-enterprise-2019 - windows2019_msvc2019: - AGENT: 'windows-2019' + # # Full path to MSVC 2019 build environment setup script: + # # https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#visual-studio-enterprise-2019 + # windows2019_msvc2019: + # AGENT: 'windows-2019' + # COMPILER: visual_studio + # COMPILER_VERSION: 16 + # SETUP_BUILD_ENV: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' + # ACTIVATE_VIRTUAL_ENV: 'call ".venv\Scripts\activate.bat"' + # INSTALL_FFMPEG: 'choco install ffmpeg -y' + + # macos14_clang15: + # AGENT: 'macOS-14' + # COMPILER: clang + # COMPILER_VERSION: 15 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'brew install ffmpeg' + + # ubuntu2204_gcc12: + # AGENT: 'ubuntu-22.04' + # COMPILER: gcc + # COMPILER_VERSION: 12 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + + # ubuntu2204_clang15: + # AGENT: 'ubuntu-22.04' + # COMPILER: clang + # COMPILER_VERSION: 15 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + + # # Not available yet + # ubuntu2404_gcc14: + # AGENT: 'ubuntu-24.04' + # COMPILER: gcc + # COMPILER_VERSION: 14 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + + # # Not available yet + # ubuntu2404_clang18: + # AGENT: 'ubuntu-24.04' + # COMPILER: clang + # COMPILER_VERSION: 18 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + + pool: + vmImage: $(AGENT) + + steps: + - task: UsePythonVersion@0 + displayName: Set Python version (3.10) + inputs: + versionSpec: '3.10' + addToPath: true + architecture: 'x64' + + - task: Cache@2 + inputs: + key: '$(Agent.JobName) | scripts/requirements.txt' + path: '$(Build.SourcesDirectory)/.venv' + cacheHitVar: 'VENV_CACHE_RESTORED' + displayName: 'Cache Virtual Environment' + + - task: Cache@2 + inputs: + key: '$(Agent.JobName) | inference_client/conanfile.py' + path: '$(Build.SourcesDirectory)/.conan' + displayName: 'Cache Conan' + + - script: | + python3 -m venv .venv + $(ACTIVATE_VIRTUAL_ENV) + pip3 install -r scripts/requirements.txt + displayName: 'Setup Virtual Environment' + condition: eq(variables['VENV_CACHE_RESTORED'], 'false') + + - script: | + $(ACTIVATE_VIRTUAL_ENV) + python3 scripts/conan/setup.py ${{BUILD_TYPE}} $(COMPILER) $(COMPILER_VERSION) -d openssl/3.2.2@ + displayName: 'Setup Conan' + + - ${{ each BUILD_TYPE in parameters.BUILD_TYPES }}: + - job: '${{BUILD_TYPE}}' + strategy: + matrix: + + # Full path to MSVC 2022 build environment setup script: + # https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#visual-studio-enterprise-2022 + windows2022_msvc2022: + AGENT: 'windows-2022' COMPILER: visual_studio - COMPILER_VERSION: 16 - SETUP_BUILD_ENV: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' + COMPILER_VERSION: 17 + SETUP_BUILD_ENV: 'call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' ACTIVATE_VIRTUAL_ENV: 'call ".venv\Scripts\activate.bat"' INSTALL_FFMPEG: 'choco install ffmpeg -y' - macos14_clang15: - AGENT: 'macOS-14' - COMPILER: clang - COMPILER_VERSION: 15 - SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' - ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' - INSTALL_FFMPEG: 'brew install ffmpeg' - - ubuntu2204_gcc12: - AGENT: 'ubuntu-22.04' - COMPILER: gcc - COMPILER_VERSION: 12 - SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' - ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' - INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' - - ubuntu2204_clang15: - AGENT: 'ubuntu-22.04' - COMPILER: clang - COMPILER_VERSION: 15 - SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' - ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' - INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + # # Full path to MSVC 2019 build environment setup script: + # # https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#visual-studio-enterprise-2019 + # windows2019_msvc2019: + # AGENT: 'windows-2019' + # COMPILER: visual_studio + # COMPILER_VERSION: 16 + # SETUP_BUILD_ENV: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' + # ACTIVATE_VIRTUAL_ENV: 'call ".venv\Scripts\activate.bat"' + # INSTALL_FFMPEG: 'choco install ffmpeg -y' + + # macos14_clang15: + # AGENT: 'macOS-14' + # COMPILER: clang + # COMPILER_VERSION: 15 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'brew install ffmpeg' + + # ubuntu2204_gcc12: + # AGENT: 'ubuntu-22.04' + # COMPILER: gcc + # COMPILER_VERSION: 12 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' + + # ubuntu2204_clang15: + # AGENT: 'ubuntu-22.04' + # COMPILER: clang + # COMPILER_VERSION: 15 + # SETUP_BUILD_ENV: 'echo $(COMPILER) $(COMPILER_VERSION)' + # ACTIVATE_VIRTUAL_ENV: 'source .venv/bin/activate' + # INSTALL_FFMPEG: 'sudo apt-get install -y ffmpeg' # # Not available yet # ubuntu2404_gcc14: @@ -115,7 +218,7 @@ jobs: - task: Cache@2 inputs: - key: '$(Agent.JobName) | inference_client/conanfile.py | inference_client/examples/conanfile.txt | inference_client/tests/conanfile.txt' + key: '$(Agent.JobName)_OpenSSL | inference_client/conanfile.py | inference_client/examples/conanfile.txt | inference_client/tests/conanfile.txt' path: '$(Build.SourcesDirectory)/.conan' displayName: 'Cache Conan'