Skip to content

build.yml: Stop Codecov from failing on forks #55

build.yml: Stop Codecov from failing on forks

build.yml: Stop Codecov from failing on forks #55

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.12'] # oldest and youngest Pythons alive
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq -y --no-install-recommends graphviz
- run: python --version
- run: |
python -m pip install --upgrade pip
pip install coverage
- run: python tests/test.py --coverage
- uses: codecov/codecov-action@v4
if: github.repository == 'jrfonseca/gprof2dot'
with:
token: ${{ secrets.CODECOV_TOKEN }}
# https://docs.github.com/en/actions/guides/building-and-testing-python#publishing-to-package-registries
deploy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine check --strict dist/*
twine upload dist/*
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --generate-notes --title ${{ github.ref_name }} ${{ github.ref_name }}