Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/actions/code-coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Code coverage'
description: 'Properly rename and upload coverage artifact for later process'

inputs:
python-version:
description: 'Python version in which the tests was ran'
required: true

test-type:
description: 'Tests suite name'
required: true

runs:
using: "composite"
steps:
- name: Rename coverage file (Linux/MacOS)
if: runner.os != 'Windows'
shell: bash
run: mv .coverage .coverage.${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.test-type }}

- name: Rename coverage file (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: powershell Rename-Item .coverage coverage-${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.test-type }}.coverage

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: .coverage.${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.test-type }}
path: .coverage.${{ runner.os }}-${{ inputs.python-version }}-${{ inputs.test-type }}
include-hidden-files: true
99 changes: 29 additions & 70 deletions .github/workflows/linux-tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
name: Linux tests

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
workflow_call:

jobs:
build_container:
runs-on: ubuntu-latest
name: Build Linux container
outputs:
image_tag: ${{ steps.dockerfile_hash.outputs.tag }}
steps:
Expand Down Expand Up @@ -52,17 +41,24 @@ jobs:
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_test_suite:
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']
name: Conan ${{ matrix.test-type }} (${{ matrix.python-version }})
python-version: [3.12.3, 3.9.2, 3.8.6, 3.6.15]
test-type: [unittests, integration, functional]
include:
- test-type: unittests
test-name: Unit
- test-type: integration
test-name: Integration
- test-type: functional
test-name: Functional
name: ${{ matrix.test-name }} Tests (${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -86,24 +82,24 @@ jobs:
pip install -r conans/requirements_server.txt
pip install meson

- name: Run tests
shell: bash
- name: Run Tests
run: |
if [ "${{ matrix.test-type }}" == "unittests" ]; then
pytest test/unittests --durations=20 -n 4
elif [ "${{ matrix.test-type }}" == "integration" ]; then
pytest test/integration --durations=20 -n 4
elif [ "${{ matrix.test-type }}" == "functional" ]; then
pytest test/functional --durations=20 -n 4
fi
pytest test/${{ matrix.test-type }} --durations=20 -n auto ${{ env.PYTEST_COV_OPTIONS }}

- name: Code coverage
if: ${{ env.PYTEST_COV_OPTIONS }}
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
name: Docker Runner Tests
strategy:
matrix:
python-version: [3.12, 3.9]
name: Docker Runner Tests (${{ matrix.python-version }})
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand All @@ -124,48 +120,11 @@ jobs:
- name: Run tests
shell: bash
run: |
pytest -m docker_runner --durations=20 -rs
pytest -m docker_runner --durations=20 -rs ${{ env.PYTEST_COV_OPTIONS }}

deploy_to_pypi_test:
needs: [build_container, linux_test_suite, linux_docker_tests]
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
- name: Code coverage
if: ${{ env.PYTEST_COV_OPTIONS }}
uses: ./.github/actions/code-coverage
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/*
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
106 changes: 106 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Main Workflow
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

env:
PYTEST_COV_OPTIONS: ${{ github.ref_name == 'develop2' && '--cov=conan --cov-report=term-missing:skip-covered' || '' }}

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
name: Code coverage
if: github.ref == 'refs/heads/develop2' # Only measure code coverage on main branch
needs: [osx_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: Code coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

- uses: geekyeggo/delete-artifact@v5
with:
name: |
.coverage.*

deploy_to_pypi_test:
runs-on: ubuntu-latest
if: false
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/*
43 changes: 21 additions & 22 deletions .github/workflows/osx-tests.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
name: OSX Tests

on:
push:
branches:
- develop2
- release/*
pull_request:
branches:
- '*'
- 'release/*'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
workflow_call:

jobs:
setup-caches:
osx_setup:
runs-on: macos-14
name: Setup and Cache Dependencies
steps:
Expand Down Expand Up @@ -118,18 +107,22 @@ jobs:
chmod +x ${HOME}/Applications/bazel/${version}/bazel
done

testing:
needs: setup-caches
osx_tests:
needs: osx_setup
runs-on: macos-14
strategy:
fail-fast: true
matrix:
python-version: ['3.8', '3.12', '3.13']
python-version: [3.8, 3.12, 3.13]
test-type: [unittests, integration, functional]

runs-on: macos-14

name: Conan (${{ matrix.test-type }}) (${{ matrix.python-version }})

include:
- test-type: unittests
test-name: Unit
- test-type: integration
test-name: Integration
- test-type: functional
test-name: Functional
name: ${{ matrix.test-name }} Tests (${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -174,5 +167,11 @@ jobs:
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 ${{ env.PYTEST_COV_OPTIONS }}

python -m pytest test/${{ matrix.test-type }} --durations=20 -n auto
- name: Code coverage
if: ${{ env.PYTEST_COV_OPTIONS }}
uses: ./.github/actions/code-coverage
with:
python-version: ${{ matrix.python-version }}
test-type: ${{ matrix.test-type }}
Loading
Loading