Fix display name in html report (#920) #1615
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 workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Deploy | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
jobs: | |
release-check: | |
runs-on: ubuntu-22.04 | |
continue-on-error: ${{ startsWith(github.event.ref,'refs/heads/') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: fetch all tags # need annotated tags for release checklist | |
run: | | |
git fetch --force --tags --depth=1 | |
- name: For a dry run, don't verify tags and documentation | |
if: ${{ ! startsWith(github.event.ref, 'refs/tags/') }} | |
run: | | |
echo "EXTRA_CHECKLIST_ARGS=--no-verify-tags --no-verify-docs-next-version" >> $GITHUB_ENV | |
- name: Run release checklist | |
run: | | |
admin/release_checklist.sh $EXTRA_CHECKLIST_ARGS 7.2+main | |
deploy: | |
runs-on: ubuntu-22.04 | |
needs: release-check | |
permissions: | |
contents: write # Needed for pushing the tag | |
env: | |
FORCE_COLOR: "1" | |
PYTHON_VERSION: "3.8" | |
CC: "gcc-11" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('noxfile.py', 'doc/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install build commands and GCC | |
run: | | |
sudo apt update | |
sudo apt-get install -y \ | |
make \ | |
ninja-build \ | |
$CC \ | |
$(echo $CC | sed -e 's/gcc/g\+\+/') | |
sudo apt-get clean | |
- name: Install libxml2 | |
run: | | |
sudo apt-get install -y libxml2-utils | |
sudo apt-get clean | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install nox requests | |
- name: Lint files | |
run: | | |
nox --non-interactive --session lint | |
- name: Test with pytest | |
run: | | |
nox --non-interactive --session tests | |
- name: Generate documentation | |
run: | | |
nox --non-interactive --session doc | |
# Check if files are modified (outdated screenshots) | |
Status=$(git status --porcelain | grep -F '.jpeg' || exit 0) | |
if [ -n "$Status" ] ; then | |
echo "Following files are modified:" | |
echo "$Status" | |
echo "Please regenerate the screenshots!" | |
exit 1 | |
fi | |
exit 0 | |
- name: Test bundle of app | |
run: | | |
nox --non-interactive --session bundle_app | |
- name: Build wheel | |
run: | | |
nox --non-interactive --session build_wheel | |
- name: Check wheel | |
run: | | |
nox --non-interactive --session check_wheel | |
- name: Upload distribution | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/** | |
- name: Apply new tag if version is bumped | |
if: ${{ success() && (github.event.ref == 'refs/heads/main') }} | |
run: | | |
set -e | |
# need to prevent creation of an existing tag | |
git fetch --force --tags --depth=1 | |
# Set git user info | |
git config --global user.email "noreply@gcovr.com" | |
git config --global user.name "gcovr authors" | |
# Get the version | |
Version="$(sed -n 's/__version__.*"\(.*\)"/\1/ p' gcovr/version.py)" | |
# Try to create the tag and print the output. It's only pushed if it's a real release | |
git tag -a "$Version" -m "$Version ($(date -I))" | |
git tag --list -n "$Version" | |
# Check if it is a new release | |
VersionPostfix="$(echo "$Version" | sed -n 's/^[0-9]*\.[0-9]*// p')" | |
if [ -z "$VersionPostfix" ]; then | |
echo "New version bumped" | |
git push origin "refs/tags/$Version" | |
echo "TAG_PUSHED=true" >> $GITHUB_ENV | |
else | |
echo "Skip pushing tag for development build" | |
echo "TAG_PUSHED=false" >> $GITHUB_ENV | |
fi | |
- name: Publish | |
if: ${{ success() && (github.event.ref == 'refs/heads/main') && (env.TAG_PUSHED == 'true') }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python -m nox --session upload_wheel |