Skip to content

Commit f48c73d

Browse files
committed
Rework all github workflows
- Moved workflows to actions so they can be reused - Removed the dependency on boost - Moved third party libraries to ./thirdparties - Fix formatting issue - Fix the formatting and import sort orders
1 parent 45d71b3 commit f48c73d

39 files changed

+674
-669
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: checkout
2+
description: checkout
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Harden the runner (Audit all outbound calls)
8+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
9+
with:
10+
egress-policy: audit
11+
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Build Wheel'
2+
description: 'Build wheel'
3+
4+
inputs:
5+
os:
6+
description: "operating system"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Build and test C++ Components (Linux)
13+
if: inputs.os == 'Linux'
14+
shell: bash
15+
run: |
16+
CXX=$(which g++-14) ./scripts/build.sh
17+
18+
- name: Build and test C++ Components (Windows)
19+
if: inputs.os == 'Windows'
20+
shell: pwsh
21+
run: |
22+
cmake --preset windows-x64
23+
cmake --build --preset windows-x64 --config Debug
24+
cmake --install build_windows_x64 --config Debug
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Build Documentation'
2+
description: 'Build Documentation'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Install dependencies
8+
shell: bash
9+
run: |
10+
uv pip install --system -r pyproject.toml
11+
uv pip install --system -r docs/requirements_docs.txt
12+
13+
- name: Build documentation
14+
shell: bash
15+
run: cd docs && make html
16+
17+
- name: Upload Pages artifact
18+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
19+
with:
20+
path: './docs/build/html'
21+
22+
- name: Deploy to GitHub Pages
23+
id: deployment
24+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: publish-pypi
2+
description: publish-pypi
3+
4+
inputs:
5+
os:
6+
description: "operating system"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Install Python Packages
13+
if: inputs.os == 'Linux'
14+
shell: bash
15+
run: |
16+
uv pip install --system --upgrade build cibuildwheel
17+
rm -rf dist
18+
19+
- name: Build Sdist
20+
if: inputs.os == 'Linux'
21+
shell: bash
22+
run: |
23+
python -m build --sdist
24+
25+
- name: Build Wheel (Linux)
26+
if: inputs.os == 'Linux'
27+
shell: bash
28+
run: python -m cibuildwheel --output-dir dist
29+
env:
30+
CIBW_BUILD: "*manylinux_x86_64"
31+
CIBW_SKIP: "pp*"
32+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
33+
34+
# - name: Publish to PyPI
35+
# uses: pypa/gh-action-pypi-publish@db8f07d3871a0a180efa06b95d467625c19d5d5f # release/v1
36+
# with:
37+
# packages_dir: ./dist/
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Run Linter'
2+
description: 'Run Linter'
3+
4+
inputs:
5+
os:
6+
description: "operating system"
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Install Python Packages (Linux)
13+
if: inputs.os == 'Linux'
14+
shell: bash
15+
run: |
16+
uv pip install --system flake8 pyproject-flake8 mypy
17+
uv pip install --system -r pyproject.toml --all-extras
18+
19+
- name: Install Python Packages (Windows)
20+
if: inputs.os == 'Windows'
21+
shell: bash
22+
run: |
23+
uv pip install --system flake8 pyproject-flake8 mypy
24+
uv pip install --system -r pyproject.toml --extra graphblas --extra gui
25+
26+
- name: Lint With flake8
27+
shell: bash
28+
run: |
29+
pflake8 .
30+
31+
- name: Lint With MyPy
32+
shell: bash
33+
run: |
34+
mypy --install-types --non-interactive .
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Run Tests With Wheel Installed'
2+
description: 'Run Unit Tests And Examples With Wheel Installed'
3+
4+
inputs:
5+
os:
6+
description: "operating system"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
# TODO: build wheel first, then run the test
13+
- name: Run Unittests And Examples
14+
shell: bash
15+
run: |
16+
python -m unittest discover -v tests
17+
uv pip install --system -r examples/applications/requirements_applications.txt
18+
for example in "./examples"/*.py; do
19+
echo "Running $example"
20+
PYTHONPATH=. python $example
21+
done
22+
for example in "./examples/applications"/*.py; do
23+
echo "Running $example"
24+
PYTHONPATH=. python $example
25+
done
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Setup Environment'
2+
description: 'Setup Environment'
3+
4+
inputs:
5+
os:
6+
description: "operating system"
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Set up Python
13+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
14+
with:
15+
python-version: "3.10"
16+
17+
- name: Update System (Linux)
18+
shell: bash
19+
if: inputs.os == 'Linux'
20+
run: |
21+
sudo apt update -y
22+
sudo apt install -y tzdata cmake clang curl pkg-config g++-14
23+
sudo chmod 755 ./scripts/download_install_libraries.sh
24+
sudo chmod 755 ./scripts/build.sh
25+
26+
- name: Install Python Base Packages
27+
shell: bash
28+
run: |
29+
pip install uv
30+
uv pip install --system --upgrade pip
31+
32+
- name: Cache Library Install
33+
id: cache-library
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
./thirdparties
38+
key: ${{ inputs.os }}-${{ hashFiles('/scripts/download_install_libraries.*') }}
39+
40+
- name: Download/Compile Libraries (Linux)
41+
shell: bash
42+
if: (inputs.os == 'Linux') && (steps.cache-library.outputs.cache-hit != 'true')
43+
run: |
44+
sudo ./scripts/download_install_libraries.sh capnp
45+
46+
- name: Download/Compile Libraries (Windows)
47+
shell: pwsh
48+
if: (inputs.os == 'Windows') && (steps.cache-boost-windows.outputs.cache-hit != 'true')
49+
run: |
50+
./scripts/download_install_libraries.ps1 capnp
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Build And Test"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build_and_test:
14+
name: Build And Test
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ ubuntu-latest ] # , windows-latest ] , macos-latest ]
19+
20+
steps:
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
26+
- name: 'Checkout Repository'
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- uses: ./.github/actions/setup-env
30+
with:
31+
os: ${{ runner.os }}
32+
33+
- uses: ./.github/actions/compile-library
34+
with:
35+
os: ${{ runner.os }}
36+
37+
- uses: ./.github/actions/run-linter
38+
with:
39+
os: ${{ runner.os }}
40+
41+
- uses: ./.github/actions/run-test
42+
with:
43+
os: ${{ runner.os }}
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Dependency Review'
2-
on: [pull_request]
2+
on: [ pull_request ]
33

44
permissions:
55
contents: read
@@ -9,17 +9,18 @@ jobs:
99
dependency-review:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Harden the runner (Audit all outbound calls)
13-
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
14-
with:
15-
egress-policy: audit
12+
- name: Harden the runner (Audit all outbound calls)
13+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
14+
with:
15+
egress-policy: audit
1616

17-
- name: 'Checkout Repository'
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19-
- name: Dependency Review
20-
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
21-
with:
22-
comment-summary-in-pr: always
23-
fail-on-severity: high
24-
allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0
25-
fail-on-scopes: development, runtime
17+
- name: 'Checkout Repository'
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
20+
- name: Dependency Review
21+
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1
22+
with:
23+
comment-summary-in-pr: always
24+
fail-on-severity: high
25+
allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0
26+
fail-on-scopes: development, runtime

.github/workflows/documentation.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)