-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralize workflow calls and add code coverage
Co-authored-by: Carlos Zoido <[email protected]>
- Loading branch information
Showing
9 changed files
with
229 additions
and
111 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,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 |
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
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,117 @@ | ||
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 | ||
|
||
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 | ||
needs: [linux_suite, osx_suite, windows_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 | ||
id: coverageComment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
pytest-xml-coverage-path: ./coverage.xml | ||
xml-skip-covered: true # Only display non fully covered files | ||
hide-report: true # Avoids GitHub message length limit issue | ||
|
||
- name: Update coverage badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }} | ||
gistID: f305b2c105b15ff2b620a7a728b14934 | ||
filename: conan-coverage.json | ||
label: Coverage Report | ||
message: ${{ steps.coverageComment.outputs.coverage }} | ||
color: ${{ steps.coverageComment.outputs.color }} | ||
namedLogo: python | ||
|
||
- uses: geekyeggo/delete-artifact@v5 | ||
with: | ||
name: | | ||
.coverage.* | ||
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/* |
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
Oops, something went wrong.