-
Notifications
You must be signed in to change notification settings - Fork 387
59 lines (56 loc) · 1.76 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 }}