From e35d288e4e1adda9e3acf3a36fcbe94efa22765b Mon Sep 17 00:00:00 2001 From: PerseoGI Date: Wed, 18 Dec 2024 16:39:14 +0100 Subject: [PATCH] Resplitted workflows --- .github/workflows/linux-tests.yml | 126 ++++++ .github/workflows/main.yml | 94 +++++ .github/workflows/osx-tests.yml | 174 ++++++++ .github/workflows/tests.yml | 678 ------------------------------ .github/workflows/win-tests.yml | 266 ++++++++++++ 5 files changed, 660 insertions(+), 678 deletions(-) create mode 100644 .github/workflows/linux-tests.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/osx-tests.yml delete mode 100644 .github/workflows/tests.yml create mode 100644 .github/workflows/win-tests.yml diff --git a/.github/workflows/linux-tests.yml b/.github/workflows/linux-tests.yml new file mode 100644 index 00000000000..86c8ccefbf4 --- /dev/null +++ b/.github/workflows/linux-tests.yml @@ -0,0 +1,126 @@ +name: Linux tests + +on: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_container: + runs-on: ubuntu-latest + outputs: + image_tag: ${{ steps.dockerfile_hash.outputs.tag }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Calculate Dockerfile checksum + id: dockerfile_hash + run: | + DOCKERFILE_HASH=$(find ./.ci/docker/conan-tests -type f -exec sha256sum {} \; | sha256sum | cut -d' ' -f1) + echo "tag=$DOCKERFILE_HASH" >> $GITHUB_OUTPUT + + - name: Check if image exists + id: check_image + run: | + if docker manifest inspect ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} > /dev/null 2>&1; then + echo "status=exists" >> $GITHUB_OUTPUT + else + echo "status=no-image" >> $GITHUB_OUTPUT + fi + + - name: Build and push image if not exists + if: steps.check_image.outputs.status == 'no-image' + run: | + docker build -t ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} -f ./.ci/docker/conan-tests . + docker push ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} + + linux_tests: + needs: build_container + runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository_owner }}/conan-tests:${{ needs.build_container.outputs.image_tag }} + options: --user conan + strategy: + matrix: + # python-version: [3.12.3, 3.9.2, 3.8.6, 3.6.15] + # test-type: [unittests, integration, functional] + python-version: [3.12.3] + test-type: [unittests] + name: Conan ${{ matrix.test-type }} (${{ matrix.python-version }}) + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + run: | + pyenv global ${{ matrix.python-version }} + python --version + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_dev.txt + pip install -r conans/requirements_server.txt + pip install meson + + - name: Run Tests + run: | + pytest test/${{ matrix.test-type }} --durations=20 -n auto --cov=conan + + - name: Code coverage + uses: ./.github/actions/code-coverage + with: + python-version: ${{ matrix.python-version }} + test-type: ${{ matrix.test-type }} + + linux_docker_tests: + needs: build_container + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.12, 3.9] + name: Conan Docker Runner Tests (${{ matrix.python-version }}) + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_dev.txt + pip install -r conans/requirements_server.txt + pip install -r conans/requirements_runner.txt + + - name: Run tests + shell: bash + run: | + pytest -m docker_runner --durations=20 -rs + + - name: Code coverage + uses: ./.github/actions/code-coverage + with: + python-version: ${{ matrix.python-version }} + test-type: ${{ matrix.test-type }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..1b814c8d5b1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,94 @@ +name: Main Workflow +on: + push: + branches: + - develop2 + - release/* + - '*' + pull_request: + branches: + - '*' + - 'release/*' + workflow_dispatch: + +jobs: + linux_suite: + uses: ./.github/workflows/linux-tests.yml + name: Linux test suite + + # osx_suite: + # uses: ./.github/workflows/osx-tests.yml + # name: OSX test suite + # + # windows_suite: + # uses: ./.github/workflows/win-tests.yml + # name: Windows test suite + + code_coverage: + runs-on: ubuntu-latest + # needs: [linux_suite, osx_suite, windows_suite] + needs: [linux_suite] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download coverage artifacts + uses: actions/download-artifact@v4 + with: + merge-multiple: true + + - name: Merge coverage reports + run: | + pip install coverage + coverage combine + coverage report + coverage xml + + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-xml-coverage-path: ./coverage.xml + + deploy_to_pypi_test: + needs: [linux_suite] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/develop2' + name: Deploy to TestPyPI + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install twine + + - name: Bump Dev Version + run: | + python .ci/bump_dev_version.py + + - name: Build Package + run: | + python setup.py sdist + + - name: Upload to TestPyPI + env: + TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} + run: | + python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/* + + - name: Deploy conan-server to TestPyPI + env: + TWINE_USERNAME: ${{ secrets.TEST_PYPI_SERVER_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_SERVER_PASSWORD }} + run: | + rm -rf dist/ + mv setup_server.py setup.py + python setup.py sdist + python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/* diff --git a/.github/workflows/osx-tests.yml b/.github/workflows/osx-tests.yml new file mode 100644 index 00000000000..79aa990cbe3 --- /dev/null +++ b/.github/workflows/osx-tests.yml @@ -0,0 +1,174 @@ +name: OSX Tests + +on: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + osx_setup: + runs-on: macos-14 + name: Setup and Cache Dependencies + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Cache pip packages + id: cache-pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('conans/requirements*.txt') }} + + - name: Install Python requirements + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_server.txt + pip install -r conans/requirements_dev.txt + pip install meson + + - name: Uninstall default CMake + run: brew uninstall cmake || true + + - name: Cache Homebrew packages + id: cache-brew + uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew + key: ${{ runner.os }}-brew + + - name: Install homebrew dependencies + run: | + brew install xcodegen make libtool zlib autoconf automake ninja + + - name: Cache CMake and Bazel installations + id: cache-tools + uses: actions/cache@v4 + with: + path: | + ~/Applications/CMake/3.15.7 + ~/Applications/CMake/3.19.7 + ~/Applications/CMake/3.23.5 + ~/Applications/bazel/6.5.0 + ~/Applications/bazel/7.4.1 + ~/Applications/bazel/8.0.0 + key: ${{ runner.os }}-conan-tools-cache + + - name: Build CMake old versions not available for ARM + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + set -e + CMAKE_BUILD_VERSIONS=("3.15.7") + for version in "${CMAKE_BUILD_VERSIONS[@]}"; do + echo "Compiling CMake version ${version} from source for ARM..." + wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}.tar.gz + tar -xzf cmake-${version}.tar.gz + cd cmake-${version} + mkdir build && cd build + ../bootstrap --prefix=${HOME}/Applications/CMake/${version} -- -DCMAKE_USE_OPENSSL=ON + make -j$(sysctl -n hw.ncpu) + make install + ${HOME}/Applications/CMake/${version}/bin/cmake --version + cd ../../ + rm -rf cmake-${version} cmake-${version}.tar.gz + done + + - name: Install universal CMake versions + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + set -e + CMAKE_PRECOMP_VERSIONS=("3.19.7" "3.23.5") + for version in "${CMAKE_PRECOMP_VERSIONS[@]}"; do + echo "Downloading and installing precompiled universal CMake version ${version}..." + wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}-macos-universal.tar.gz + tar -xzf cmake-${version}-macos-universal.tar.gz \ + --exclude=CMake.app/Contents/bin/cmake-gui \ + --exclude=CMake.app/Contents/doc/cmake \ + --exclude=CMake.app/Contents/share/cmake-${version%.*}/Help \ + --exclude=CMake.app/Contents/share/vim + mkdir -p ${HOME}/Applications/CMake/${version} + cp -fR cmake-${version}-macos-universal/CMake.app/Contents/* ${HOME}/Applications/CMake/${version} + ${HOME}/Applications/CMake/${version}/bin/cmake --version + rm -rf cmake-${version}-macos-universal + rm cmake-${version}-macos-universal.tar.gz + done + + - name: Install Bazel versions + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + set -e + for version in 6.5.0 7.4.1 8.0.0; do + mkdir -p ${HOME}/Applications/bazel/${version} + wget -q -O ${HOME}/Applications/bazel/${version}/bazel https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64 + chmod +x ${HOME}/Applications/bazel/${version}/bazel + done + + osx_tests: + needs: osx_setup + runs-on: macos-14 + strategy: + fail-fast: true + matrix: + python-version: [3.8, 3.12, 3.13] + test-type: [unittests, integration, functional] + name: Conan ${{ matrix.test-type }} (${{ matrix.python-version }}) + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore pip cache + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('conans/requirements*.txt') }} + + - name: Restore tools cache + uses: actions/cache@v4 + with: + path: | + ~/Applications/CMake/3.15.7 + ~/Applications/CMake/3.19.7 + ~/Applications/CMake/3.23.5 + ~/Applications/bazel/6.5.0 + ~/Applications/bazel/7.4.1 + ~/Applications/bazel/8.0.0 + key: ${{ runner.os }}-conan-tools-cache + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python Dependencies + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_server.txt + pip install -r conans/requirements_dev.txt + pip install meson + + - name: Install homebrew dependencies + run: | + brew install xcodegen make libtool zlib autoconf automake ninja + + - name: Run Tests + run: | + export PATH=${HOME}/Applications/CMake/3.15.7/bin:$PATH:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin + cmake --version + bazel --version + + python -m pytest test/${{ matrix.test-type }} --durations=20 -n auto + + - name: Code coverage + uses: ./.github/actions/code-coverage + with: + python-version: ${{ matrix.python-version }} + test-type: ${{ matrix.test-type }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index d63a324324e..00000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,678 +0,0 @@ -name: Tests and QA - -on: - push: - branches: - - develop2 - - release/* - pull_request: - branches: - - '*' - - 'release/*' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - - ############################################################################## - # LINUX ENVIRONMENT # - ############################################################################## - - linux_setup: - name: Linux - Create build container - runs-on: ubuntu-latest - outputs: - image_tag: ${{ steps.dockerfile_hash.outputs.tag }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Calculate Dockerfile checksum - id: dockerfile_hash - run: | - DOCKERFILE_HASH=$(find ./.ci/docker/conan-tests -type f -exec sha256sum {} \; | sha256sum | cut -d' ' -f1) - echo "tag=$DOCKERFILE_HASH" >> $GITHUB_OUTPUT - - - name: Check if image exists - id: check_image - run: | - if docker manifest inspect ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} > /dev/null 2>&1; then - echo "status=exists" >> $GITHUB_OUTPUT - else - echo "status=no-image" >> $GITHUB_OUTPUT - fi - - - name: Build and push image if not exists - if: steps.check_image.outputs.status == 'no-image' - run: | - docker build -t ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} -f ./.ci/docker/conan-tests . - docker push ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} - - linux_tests: - needs: linux_setup - runs-on: ubuntu-latest - container: - image: ghcr.io/${{ github.repository_owner }}/conan-tests:${{ needs.linux_setup.outputs.image_tag }} - options: --user conan - strategy: - matrix: - python-version: [3.12.3, 3.9.2, 3.8.6, 3.6.15] - test-type: [unittests, integration, functional] - name: Linux - Conan ${{ matrix.test-type }} (${{ matrix.python-version }}) - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - run: | - pyenv global ${{ matrix.python-version }} - python --version - - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} - - - name: Install Python dependencies - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_dev.txt - pip install -r conans/requirements_server.txt - pip install meson - - - name: Run tests - shell: bash - run: | - pytest test/${{ matrix.test-type }} --durations=20 -n 4 --cov=conan - - - name: Rename coverage file (Linux/MacOS) - if: runner.os != 'Windows' - run: mv .coverage .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - - - name: Rename coverage file (Windows) - if: runner.os == 'Windows' - run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}.coverage - - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - path: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - include-hidden-files: true - - linux_tests_docker: - needs: linux_setup - runs-on: ubuntu-latest - name: Linux - Docker Runner Tests - strategy: - matrix: - python-version: [3.12, 3.9] - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python dependencies - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_dev.txt - pip install -r conans/requirements_server.txt - pip install -r conans/requirements_runner.txt - - - name: Run tests - shell: bash - run: | - pytest -m docker_runner --durations=20 -rs --cov=conan - - - name: Rename coverage file (Linux/MacOS) - if: runner.os != 'Windows' - run: mv .coverage .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - - - name: Rename coverage file (Windows) - if: runner.os == 'Windows' - run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}.coverage - - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - path: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - include-hidden-files: true - - ############################################################################## - # MACOS ENVIRONMENT # - ############################################################################## - - osx_setup: - name: OSX - Setup and Cache Dependencies - runs-on: macos-14 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - - name: Cache pip packages - id: cache-pip - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('conans/requirements*.txt') }} - - - name: Install Python requirements - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_server.txt - pip install -r conans/requirements_dev.txt - pip install meson - - - name: Uninstall default CMake - run: brew uninstall cmake || true - - - name: Cache Homebrew packages - id: cache-brew - uses: actions/cache@v4 - with: - path: ~/Library/Caches/Homebrew - key: ${{ runner.os }}-brew - - - name: Install homebrew dependencies - run: | - brew install xcodegen make libtool zlib autoconf automake ninja - - - name: Cache CMake and Bazel installations - id: cache-tools - uses: actions/cache@v4 - with: - path: | - ~/Applications/CMake/3.15.7 - ~/Applications/CMake/3.19.7 - ~/Applications/CMake/3.23.5 - ~/Applications/bazel/6.5.0 - ~/Applications/bazel/7.4.1 - ~/Applications/bazel/8.0.0 - key: ${{ runner.os }}-conan-tools-cache - - - name: Build CMake old versions not available for ARM - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - set -e - CMAKE_BUILD_VERSIONS=("3.15.7") - for version in "${CMAKE_BUILD_VERSIONS[@]}"; do - echo "Compiling CMake version ${version} from source for ARM..." - wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}.tar.gz - tar -xzf cmake-${version}.tar.gz - cd cmake-${version} - mkdir build && cd build - ../bootstrap --prefix=${HOME}/Applications/CMake/${version} -- -DCMAKE_USE_OPENSSL=ON - make -j$(sysctl -n hw.ncpu) - make install - ${HOME}/Applications/CMake/${version}/bin/cmake --version - cd ../../ - rm -rf cmake-${version} cmake-${version}.tar.gz - done - - - name: Install universal CMake versions - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - set -e - CMAKE_PRECOMP_VERSIONS=("3.19.7" "3.23.5") - for version in "${CMAKE_PRECOMP_VERSIONS[@]}"; do - echo "Downloading and installing precompiled universal CMake version ${version}..." - wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}-macos-universal.tar.gz - tar -xzf cmake-${version}-macos-universal.tar.gz \ - --exclude=CMake.app/Contents/bin/cmake-gui \ - --exclude=CMake.app/Contents/doc/cmake \ - --exclude=CMake.app/Contents/share/cmake-${version%.*}/Help \ - --exclude=CMake.app/Contents/share/vim - mkdir -p ${HOME}/Applications/CMake/${version} - cp -fR cmake-${version}-macos-universal/CMake.app/Contents/* ${HOME}/Applications/CMake/${version} - ${HOME}/Applications/CMake/${version}/bin/cmake --version - rm -rf cmake-${version}-macos-universal - rm cmake-${version}-macos-universal.tar.gz - done - - - name: Install Bazel versions - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - set -e - for version in 6.5.0 7.4.1 8.0.0; do - mkdir -p ${HOME}/Applications/bazel/${version} - wget -q -O ${HOME}/Applications/bazel/${version}/bazel https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64 - chmod +x ${HOME}/Applications/bazel/${version}/bazel - done - - osx_tests: - needs: osx_setup - runs-on: macos-14 - strategy: - fail-fast: true - matrix: - python-version: [3.8, 3.12, 3.13] - test-type: [unittests, integration, functional] - name: OSX - Conan ${{ matrix.test-type }} (${{ matrix.python-version }}) - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore tools cache - uses: actions/cache@v4 - with: - path: | - ~/Applications/CMake/3.15.7 - ~/Applications/CMake/3.19.7 - ~/Applications/CMake/3.23.5 - ~/Applications/bazel/6.5.0 - ~/Applications/bazel/7.4.1 - ~/Applications/bazel/8.0.0 - key: ${{ runner.os }}-conan-tools-cache - - - name: Install homebrew dependencies - run: | - brew install xcodegen make libtool zlib autoconf automake ninja - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Restore pip cache - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('conans/requirements*.txt') }} - - - name: Install Python Dependencies - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_server.txt - pip install -r conans/requirements_dev.txt - pip install meson - - - name: Run tests - run: | - export PATH=${HOME}/Applications/CMake/3.15.7/bin:$PATH:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin - cmake --version - bazel --version - pytest test/${{ matrix.test-type }} --durations=20 -n auto --cov=conan - pwd - - - name: Rename coverage file (Linux/MacOS) - if: runner.os != 'Windows' - run: mv .coverage .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - - - name: Rename coverage file (Windows) - if: runner.os == 'Windows' - run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}.coverage - - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - path: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - include-hidden-files: true - - ############################################################################## - # WINDOWS ENVIRONMENT # - ############################################################################## - - windows_tests_unit_integration: - runs-on: windows-2022 - strategy: - matrix: - python-version: [3.13, 3.8, 3.6] - - name: Windows - Unit & Integration Tests (${{ matrix.python-version }}) - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Visual Studio Build Tools - run: | - Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "vs_buildtools15.exe" - Start-Process -FilePath ".\vs_buildtools15.exe" -ArgumentList ` - "--quiet", "--wait", "--norestart", "--nocache", ` - "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", ` - "--add", "Microsoft.Component.MSBuild" -WindowStyle Hidden -Wait - - - name: Determine pip cache directory - id: pip-cache-dir - shell: pwsh - run: echo "PIP_CACHE_DIR=$(pip cache dir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache pip packages - uses: actions/cache@v4 - with: - path: ${{ env.PIP_CACHE_DIR }} - key: pip-packages-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} - restore-keys: | - pip-packages-${{ runner.os }}-${{ matrix.python-version }}- - - - name: Install Python requirements - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_dev.txt - pip install -r conans/requirements_server.txt - - - name: Run Unit & Integration Tests - shell: pwsh - run: | - git config --global core.autocrlf false - pytest test/unittests test/integration --durations=100 -n=auto --cov=conan - - - name: Rename coverage file (Linux/MacOS) - if: runner.os != 'Windows' - run: mv .coverage .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - - - name: Rename coverage file (Windows) - if: runner.os == 'Windows' - run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}.coverage - - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - path: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - include-hidden-files: true - - - windows_tests_functional: - runs-on: windows-2022 - strategy: - matrix: - python-version: [3.13, 3.8, 3.6] - - name: Windows - Functional Tests (${{ matrix.python-version }}) - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install MSVC v14.38 Toolset - run: | - Start-Process -Wait "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList {` - modify ` - --quiet ` - --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` - --add ` - Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64 ` - } - - - name: Verify MSVC v14.38 toolset installation - run: dir "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC" - - - name: Install Visual Studio Build Tools - run: | - Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "vs_buildtools15.exe" - Start-Process -FilePath ".\vs_buildtools15.exe" -ArgumentList ` - "--quiet", "--wait", "--norestart", "--nocache", ` - "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", ` - "--add", "Microsoft.VisualStudio.Component.Windows81SDK", ` - "--add", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", ` - "--add", "Microsoft.Component.MSBuild", ` - "--add", "Microsoft.VisualStudio.Component.VC.140" -WindowStyle Hidden -Wait - - - name: Determine pip cache directory - id: pip-cache-dir - shell: pwsh - run: echo "PIP_CACHE_DIR=$(pip cache dir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache pip packages - uses: actions/cache@v4 - with: - path: ${{ env.PIP_CACHE_DIR }} - key: pip-packages-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} - restore-keys: | - pip-packages-${{ runner.os }}-${{ matrix.python-version }}- - - - name: Install Python requirements - run: | - pip install --upgrade pip - pip install -r conans/requirements.txt - pip install -r conans/requirements_server.txt - pip install -r conans/requirements_dev.txt - pip install meson - - - name: Set choco cache - run: choco config set cacheLocation C:\choco-cache - - - uses: actions/cache@v4 - with: - path: C:\choco-cache - key: choco-cache - - - name: Install Chocolatey packages - run: | - choco install pkgconfiglite --version 0.28 - choco install ninja --version 1.10.2 - choco install mingw - choco install cygwin - choco install cyg-get - cyg-get automake gcc-g++ make binutils --verbose - - - uses: msys2/setup-msys2@v2 - id: msys2-setup - with: - update: true - # It's important that the default environment that is used is MSYS - # we check this default in a test - msystem: MSYS - install: >- - mingw-w64-x86_64-toolchain - mingw-w64-i686-toolchain - base-devel - gcc - autoconf-wrapper - automake - - - name: Cache CMake and Bazel installations - id: cache-tools - uses: actions/cache@v4 - with: - path: | - C:\tools\cmake\3.15.7 - C:\tools\cmake\3.19.7 - C:\tools\cmake\3.23.5 - C:\tools\bazel\6.5.0 - C:\tools\bazel\7.4.1 - C:\tools\bazel\8.0.0 - key: ${{ runner.os }}-conan-tools-cache - - - name: Build CMake old versions of CMake - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - $CMAKE_BUILD_VERSIONS = "3.15.7", "3.19.7" - foreach ($version in $CMAKE_BUILD_VERSIONS) { - Write-Host "Downloading CMake version $version for Windows..." - $destination = "C:\tools\cmake\$version" - if (-not (Test-Path $destination)) { - New-Item -Path $destination -ItemType Directory - } - $major_minor_version = ($version -split '\.')[0..1] -join '.' - $url = "https://cmake.org/files/v$major_minor_version/cmake-$version-win64-x64.zip" - $zipFile = "cmake-$version-windows-x86_64.zip" - Invoke-WebRequest -Uri $url -OutFile $zipFile - Expand-Archive -Path $zipFile -DestinationPath $destination -Force - Remove-Item $zipFile - } - - - name: Install modern CMake versions - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - $CMAKE_BUILD_VERSIONS = "3.23.5" - foreach ($version in $CMAKE_BUILD_VERSIONS) { - $destination = "C:\tools\cmake\$version" - if (-not (Test-Path $destination)) { - New-Item -Path $destination -ItemType Directory - } - $major_minor_version = ($version -split '\.')[0..1] -join '.' - $url = "https://cmake.org/files/v$major_minor_version/cmake-$version-windows-x86_64.zip" - $zipFile = "cmake-$version-windows-x86_64.zip" - Invoke-WebRequest -Uri $url -OutFile $zipFile - Expand-Archive -Path $zipFile -DestinationPath $destination -Force - Remove-Item $zipFile - } - - - name: Install Bazel versions - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - $BAZEL_BUILD_VERSIONS = "6.5.0", "7.4.1", "8.0.0" - foreach ($version in $BAZEL_BUILD_VERSIONS) { - Write-Host "Downloading Bazel version $version for Windows..." - $destination = "C:\tools\bazel\$version" - if (-not (Test-Path $destination)) { - New-Item -Path $destination -ItemType Directory - } - $major_minor_version = ($version -split '\.')[0..1] -join '.' - $url = "https://github.com/bazelbuild/bazel/releases/download/$version/bazel-$version-windows-x86_64.zip" - $zipFile = "bazel-$version-windows-x86_64.zip" - Invoke-WebRequest -Uri $url -OutFile $zipFile - Expand-Archive -Path $zipFile -DestinationPath $destination -Force - Remove-Item $zipFile - } - - - name: Run Functional Tests - run: | - git config --global core.autocrlf false - - $pathsToRemove = @() - $pathsToRemove += "C:\mingw64\bin" # To avoid that CMake finds gcc there - $pathsToRemove += "C:\Strawberry\c\bin" - $pathsToRemove += "C:\Program Files\CMake\bin" # Remove the default CMake version - $pathsToRemove += "C:\Program Files\Git\usr\bin" # To avoid using uname and other tools from there - foreach ($dir in $pathsToRemove) { - $newPath = ($env:PATH -split ";") -ne $dir -join ";" - [System.Environment]::SetEnvironmentVariable('PATH', $newPath) - Write-Host "$dir removed from PATH. Current PATH: $env:PATH" - } - - # Check GCC is not in Path - $gccPath = Get-Command gcc.exe -ErrorAction SilentlyContinue - if ($null -ne $gccPath) { - Write-Host "GCC found in PATH at: $($gccPath.Path)" - } else { - Write-Host "GCC not found in PATH." - } - - $shortGuid = [System.Guid]::NewGuid().ToString().Substring(0, 4) - $randomFolder = [System.IO.Path]::Combine("D:\\", "tmp_tests", $shortGuid) - New-Item -ItemType Directory -Force -Path $randomFolder - $env:CONAN_TEST_FOLDER = $randomFolder - $env:Path = "C:\tools\cmake\3.15.7\cmake-3.15.7-win64-x64\bin;" + $env:Path - - $msys2Path = '${{ steps.msys2-setup.outputs.msys2-location }}' - [System.Environment]::SetEnvironmentVariable('MSYS2_PATH', $msys2Path, [System.EnvironmentVariableTarget]::Process) - Write-Host "Added MSYS2_PATH environment variable: $msys2Path" - - pytest test/functional -n=auto --durations=100 --cov=conan - - - name: Rename coverage file (Linux/MacOS) - if: runner.os != 'Windows' - run: mv .coverage .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - - - name: Rename coverage file (Windows) - if: runner.os == 'Windows' - run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}.coverage - - - name: Upload coverage artifact - uses: actions/upload-artifact@v4 - with: - name: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - path: .coverage.${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.test-type }} - include-hidden-files: true - - code_coverage: - needs: [linux_tests, linux_tests_docker, osx_tests, windows_tests_unit_integration, windows_tests_functional] - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download coverage artifacts - uses: actions/download-artifact@v4 - with: - merge-multiple: true - - - name: Merge coverage reports - run: | - pip install coverage - coverage combine - coverage report - coverage xml -o merged-coverage.xml - coverage html -d coverage-html - - deploy_to_pypi_test: - needs: [linux_setup, linux_tests, linux_tests_docker] - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop2' - name: Deploy to TestPyPI - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - pip install --upgrade pip - pip install twine - - - name: Bump Dev Version - run: | - python .ci/bump_dev_version.py - - - name: Build Package - run: | - python setup.py sdist - - - name: Upload to TestPyPI - env: - TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} - run: | - python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/* - - - name: Deploy conan-server to TestPyPI - env: - TWINE_USERNAME: ${{ secrets.TEST_PYPI_SERVER_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_SERVER_PASSWORD }} - run: | - rm -rf dist/ - mv setup_server.py setup.py - python setup.py sdist - python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/* diff --git a/.github/workflows/win-tests.yml b/.github/workflows/win-tests.yml new file mode 100644 index 00000000000..5482b5210a5 --- /dev/null +++ b/.github/workflows/win-tests.yml @@ -0,0 +1,266 @@ +name: Windows Tests + +on: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + unit_integration_tests: + runs-on: windows-2022 + strategy: + matrix: + python-version: [3.13, 3.8, 3.6] + name: Unit & Integration Tests (${{ matrix.python-version }}) + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Visual Studio Build Tools + run: | + Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "vs_buildtools15.exe" + Start-Process -FilePath ".\vs_buildtools15.exe" -ArgumentList ` + "--quiet", "--wait", "--norestart", "--nocache", ` + "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", ` + "--add", "Microsoft.Component.MSBuild" -WindowStyle Hidden -Wait + + - name: Determine pip cache directory + id: pip-cache-dir + shell: pwsh + run: echo "PIP_CACHE_DIR=$(pip cache dir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + + - name: Cache pip packages + uses: actions/cache@v4 + with: + path: ${{ env.PIP_CACHE_DIR }} + key: pip-packages-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} + restore-keys: | + pip-packages-${{ runner.os }}-${{ matrix.python-version }}- + + - name: Install Python requirements + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_dev.txt + pip install -r conans/requirements_server.txt + + - name: Run Unit & Integration Tests + shell: pwsh + run: | + git config --global core.autocrlf false + pytest test/unittests test/integration --durations=100 -n=auto + + - name: Code coverage + uses: ./.github/actions/code-coverage + with: + python-version: ${{ matrix.python-version }} + test-type: unit-integration + + functional_tests: + runs-on: windows-2022 + strategy: + matrix: + python-version: [3.13, 3.8, 3.6] + + name: Functional Tests (${{ matrix.python-version }}) + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install MSVC v14.38 Toolset + run: | + Start-Process -Wait "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList {` + modify ` + --quiet ` + --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` + --add ` + Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64 ` + } + + - name: Verify MSVC v14.38 toolset installation + run: dir "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC" + + - name: Install Visual Studio Build Tools + run: | + Invoke-WebRequest -Uri "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "vs_buildtools15.exe" + Start-Process -FilePath ".\vs_buildtools15.exe" -ArgumentList ` + "--quiet", "--wait", "--norestart", "--nocache", ` + "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", ` + "--add", "Microsoft.VisualStudio.Component.Windows81SDK", ` + "--add", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", ` + "--add", "Microsoft.Component.MSBuild", ` + "--add", "Microsoft.VisualStudio.Component.VC.140" -WindowStyle Hidden -Wait + + - name: Determine pip cache directory + id: pip-cache-dir + shell: pwsh + run: echo "PIP_CACHE_DIR=$(pip cache dir)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + + - name: Cache pip packages + uses: actions/cache@v4 + with: + path: ${{ env.PIP_CACHE_DIR }} + key: pip-packages-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }} + restore-keys: | + pip-packages-${{ runner.os }}-${{ matrix.python-version }}- + + - name: Install Python requirements + run: | + pip install --upgrade pip + pip install -r conans/requirements.txt + pip install -r conans/requirements_server.txt + pip install -r conans/requirements_dev.txt + pip install meson + + - name: "Set choco cache" + run: choco config set cacheLocation C:\choco-cache + + - uses: actions/cache@v4 + with: + path: C:\choco-cache + key: choco-cache + + - name: Install Chocolatey packages + run: | + choco install pkgconfiglite --version 0.28 + choco install ninja --version 1.10.2 + choco install mingw + choco install cygwin + choco install cyg-get + cyg-get automake gcc-g++ make binutils --verbose + + - uses: msys2/setup-msys2@v2 + id: msys2-setup + with: + update: true + # It's important that the default environment that is used is MSYS + # we check this default in a test + msystem: MSYS + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-i686-toolchain + base-devel + gcc + autoconf-wrapper + automake + + - name: Cache CMake and Bazel installations + id: cache-tools + uses: actions/cache@v4 + with: + path: | + C:\tools\cmake\3.15.7 + C:\tools\cmake\3.19.7 + C:\tools\cmake\3.23.5 + C:\tools\bazel\6.5.0 + C:\tools\bazel\7.4.1 + C:\tools\bazel\8.0.0 + key: ${{ runner.os }}-conan-tools-cache + + - name: Build CMake old versions of CMake + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + $CMAKE_BUILD_VERSIONS = "3.15.7", "3.19.7" + foreach ($version in $CMAKE_BUILD_VERSIONS) { + Write-Host "Downloading CMake version $version for Windows..." + $destination = "C:\tools\cmake\$version" + if (-not (Test-Path $destination)) { + New-Item -Path $destination -ItemType Directory + } + $major_minor_version = ($version -split '\.')[0..1] -join '.' + $url = "https://cmake.org/files/v$major_minor_version/cmake-$version-win64-x64.zip" + $zipFile = "cmake-$version-windows-x86_64.zip" + Invoke-WebRequest -Uri $url -OutFile $zipFile + Expand-Archive -Path $zipFile -DestinationPath $destination -Force + Remove-Item $zipFile + } + + - name: Install modern CMake versions + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + $CMAKE_BUILD_VERSIONS = "3.23.5" + foreach ($version in $CMAKE_BUILD_VERSIONS) { + $destination = "C:\tools\cmake\$version" + if (-not (Test-Path $destination)) { + New-Item -Path $destination -ItemType Directory + } + $major_minor_version = ($version -split '\.')[0..1] -join '.' + $url = "https://cmake.org/files/v$major_minor_version/cmake-$version-windows-x86_64.zip" + $zipFile = "cmake-$version-windows-x86_64.zip" + Invoke-WebRequest -Uri $url -OutFile $zipFile + Expand-Archive -Path $zipFile -DestinationPath $destination -Force + Remove-Item $zipFile + } + + - name: Install Bazel versions + if: steps.cache-tools.outputs.cache-hit != 'true' + run: | + $BAZEL_BUILD_VERSIONS = "6.5.0", "7.4.1", "8.0.0" + foreach ($version in $BAZEL_BUILD_VERSIONS) { + Write-Host "Downloading Bazel version $version for Windows..." + $destination = "C:\tools\bazel\$version" + if (-not (Test-Path $destination)) { + New-Item -Path $destination -ItemType Directory + } + $major_minor_version = ($version -split '\.')[0..1] -join '.' + $url = "https://github.com/bazelbuild/bazel/releases/download/$version/bazel-$version-windows-x86_64.zip" + $zipFile = "bazel-$version-windows-x86_64.zip" + Invoke-WebRequest -Uri $url -OutFile $zipFile + Expand-Archive -Path $zipFile -DestinationPath $destination -Force + Remove-Item $zipFile + } + + - name: Run Functional Tests + run: | + git config --global core.autocrlf false + + $pathsToRemove = @() + $pathsToRemove += "C:\mingw64\bin" # To avoid that CMake finds gcc there + $pathsToRemove += "C:\Strawberry\c\bin" + $pathsToRemove += "C:\Program Files\CMake\bin" # Remove the default CMake version + $pathsToRemove += "C:\Program Files\Git\usr\bin" # To avoid using uname and other tools from there + foreach ($dir in $pathsToRemove) { + $newPath = ($env:PATH -split ";") -ne $dir -join ";" + [System.Environment]::SetEnvironmentVariable('PATH', $newPath) + Write-Host "$dir removed from PATH. Current PATH: $env:PATH" + } + + # Check GCC is not in Path + $gccPath = Get-Command gcc.exe -ErrorAction SilentlyContinue + if ($null -ne $gccPath) { + Write-Host "GCC found in PATH at: $($gccPath.Path)" + } else { + Write-Host "GCC not found in PATH." + } + + $shortGuid = [System.Guid]::NewGuid().ToString().Substring(0, 4) + $randomFolder = [System.IO.Path]::Combine("D:\\", "tmp_tests", $shortGuid) + New-Item -ItemType Directory -Force -Path $randomFolder + $env:CONAN_TEST_FOLDER = $randomFolder + $env:Path = "C:\tools\cmake\3.15.7\cmake-3.15.7-win64-x64\bin;" + $env:Path + + $msys2Path = '${{ steps.msys2-setup.outputs.msys2-location }}' + [System.Environment]::SetEnvironmentVariable('MSYS2_PATH', $msys2Path, [System.EnvironmentVariableTarget]::Process) + Write-Host "Added MSYS2_PATH environment variable: $msys2Path" + + pytest test/functional -n=auto --durations=100 + + - name: Code coverage + uses: ./.github/actions/code-coverage + with: + python-version: ${{ matrix.python-version }} + test-type: functional