-
Notifications
You must be signed in to change notification settings - Fork 22
88 lines (82 loc) · 2.79 KB
/
python-app.yml
File metadata and controls
88 lines (82 loc) · 2.79 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This workflow installs dependencies, runs examples and tests (lint is in code-quality workflow)
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: pymdoccbor
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
jobs:
skip-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.check.outputs.should_skip }}
steps:
- uses: actions/github-script@v7
id: check
with:
script: |
const branch = process.env.BRANCH || '';
const { data: { workflow_runs } } = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
status: 'in_progress',
});
const otherRunning = workflow_runs.filter(
r => r.id != context.runId &&
r.name === context.workflow &&
(!branch || r.head_branch === branch)
);
core.setOutput('should_skip', otherRunning.length > 0 ? 'true' : 'false');
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
build:
needs: skip-check
if: needs.skip-check.outputs.should_skip != 'true'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system package
run: |
sudo apt update
sudo apt install python3-dev libssl-dev libffi-dev make automake gcc g++
- name: Create venv and install
run: |
python -m venv env
source env/bin/activate
pip install --upgrade pip setuptools
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-customizations.txt ]; then pip install -r requirements-customizations.txt; fi
pip install -e .
- name: Run examples
run: |
source env/bin/activate
chmod +x scripts/run_examples.sh
./scripts/run_examples.sh
- name: Run README and docs examples
run: |
source env/bin/activate
python scripts/run_doc_examples.py
- name: Tests with coverage
run: |
source env/bin/activate
pytest --cov=pymdoccbor --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false