Handle different compiler executables #436
Workflow file for this run
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 $EXTRA_CHECKLIST_ARGS 7.2+main | |
deploy: | |
runs-on: ubuntu-22.04 | |
needs: release-check | |
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: Publish | |
if: ${{ success() && startsWith(github.event.ref,'refs/tags/') }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python -m nox --session upload_wheel | |
tagging: | |
runs-on: ubuntu-22.04 | |
needs: deploy | |
permissions: | |
contents: write # Needed for pushing the tag | |
if: ${{ success() && (github.event.ref == 'refs/heads/main') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: fetch all tags # need to prevent creation of an existing tag | |
run: | | |
git fetch --force --tags --depth=1 | |
- name: Apply new tag if version is bumped | |
run: | | |
set -e | |
# Set git user info | |
git config --global user.email "[email protected]" | |
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" | |
else | |
echo "Skip pushing tag for development build" | |
fi |