Skip to content

Commit

Permalink
Resplitted workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
perseoGI committed Dec 19, 2024
1 parent 9d4836e commit e35d288
Show file tree
Hide file tree
Showing 5 changed files with 660 additions and 678 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
94 changes: 94 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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/*
174 changes: 174 additions & 0 deletions .github/workflows/osx-tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Loading

0 comments on commit e35d288

Please sign in to comment.