-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (127 loc) · 3.73 KB
/
test-linux.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Test Linux
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
generateDocx:
description: 'Generate docx report'
required: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
pybmds:
runs-on: ubuntu-22.04
env:
generateDocx: ${{ inputs.generateDocx }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: |
echo "generateDocx: $generateDocx"
source ./tools/linux_ci_setup.sh
if [ "$generateDocx" = "true" ]; then
sudo apt-get install -y pandoc
fi
- name: Build pybmds
run: |
source ./tools/linux_ci_env.sh
python -m pip install -U pip wheel
python -m pip install -e ".[dev,docs]"
stubgen -p pybmds.bmdscore -o src
ruff format src/pybmds/bmdscore.pyi
python -c "import pybmds; print(pybmds.bmdscore.version())"
- name: Check linked files
run: |
ls -lah src/pybmds
ldd src/pybmds/bmdscore*.so
- name: loc
run: |
sudo apt-get install -y cloc
echo "# Lines of Code Report" >> $GITHUB_STEP_SUMMARY
make loc >> $GITHUB_STEP_SUMMARY
- name: Check linting
run: |
make lint
- name: Test with pytest
run: |
coverage run -m pytest
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
coverage html -d coverage -i
- name: Build documentation
run: |
make docs
if [ "$generateDocx" = "true" ]; then
make docs-docx
mv docs/build/pybmds.docx docs/build/html/pybmds.docx
fi
- name: Upload Documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build/html
retention-days: 14
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
retention-days: 14
bmdscore:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
source ./tools/linux_ci_setup.sh
- name: Run clang-format
run: |
pip install clang-format==19.1.3
make format-cpp
git diff --exit-code --compact-summary || { echo "Code formatting failed; run 'make format-cpp'"; exit 1; }
- name: Build bmdscore
run: |
source ./tools/linux_ci_env.sh
mkdir -p src/build
cd src/build
cmake ..
make -j$(nproc)
- name: Run tests and generate report
run: |
source ./tools/linux_ci_env.sh
cd src/build
make run_tests_with_coverage
- uses: actions/upload-artifact@v4
with:
name: cpp-coverage
path: |
./src/build/coverage/*
docs:
name: Deploy documentation to GitHub Pages
needs: pybmds
runs-on: ubuntu-22.04
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: docs