-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
692 additions
and
678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Test code and manage coverage | ||
|
||
inputs: | ||
python-version: | ||
description: "Python version" | ||
required: true | ||
|
||
test-type: | ||
description: "Tests type" | ||
required: false | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
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: | ||
if: false | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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 | ||
hide-report: true | ||
|
||
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/* |
Oops, something went wrong.