Skip to content

Commit 6dba935

Browse files
committed
Rework all github workflows
1 parent 8c2673b commit 6dba935

File tree

16 files changed

+336
-293
lines changed

16 files changed

+336
-293
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'Build Wheel'
2+
description: 'Build wheel'
3+
4+
inputs:
5+
os:
6+
description: "OS to setup environment"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Build and test C++ Components
13+
shell: bash
14+
run: |
15+
CXX=$(which g++-14) ./scripts/build.sh
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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: publish-pypi
2+
description: publish-pypi
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Build Wheel
7+
shell: bash
8+
# run: python -m build
9+
run: python -m cibuildwheel --output-dir wheelhouse
10+
env:
11+
CIBW_BUILD: "*manylinux_x86_64"
12+
CIBW_SKIP: "pp*"
13+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
14+
15+
- name: Build Sdist
16+
shell: bash
17+
run: |
18+
python -m build --sdist
19+
sudo mv dist/scaler* wheelhouse/.
20+
21+
# - name: Publish to PyPI
22+
# uses: pypa/gh-action-pypi-publish@db8f07d3871a0a180efa06b95d467625c19d5d5f # release/v1
23+
# with:
24+
# packages_dir: ./wheelhouse/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Run Linter'
2+
description: 'Run Linter'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Install Python Dependent Packages
8+
shell: bash
9+
run: |
10+
uv pip install --system flake8 pyproject-flake8 mypy
11+
12+
- name: Lint With flake8
13+
shell: bash
14+
run: |
15+
pflake8 src/
16+
17+
- name: Lint With MyPy
18+
shell: bash
19+
run: |
20+
mypy --install-types --non-interactive src/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Run Tests With Wheel Installed'
2+
description: 'Run Unit Tests And Examples With Wheel Installed'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Run Unittests
8+
shell: bash
9+
run: |
10+
python -m unittest discover -v tests
11+
12+
- name: Run Examples
13+
shell: bash
14+
run: |
15+
uv pip install --system -r examples/applications/requirements_applications.txt
16+
for example in "./examples"/*.py; do
17+
echo "Running $example"
18+
PYTHONPATH=. python $example
19+
done
20+
for example in "./examples/applications"/*.py; do
21+
echo "Running $example"
22+
PYTHONPATH=. python $example
23+
done
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Setup Environment'
2+
description: 'Setup Environment'
3+
4+
inputs:
5+
os:
6+
description: "OS to setup environment"
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: Install necessary component
18+
shell: bash
19+
run: |
20+
sudo apt update -y
21+
sudo apt upgrade -y
22+
sudo DEBIAN_FRONTEND=noninteractive sudo apt install -y tzdata
23+
sudo apt install -y cmake clang curl pkg-config g++-14
24+
25+
- name: Install python package
26+
shell: bash
27+
run: |
28+
pip install uv
29+
uv pip install --system --upgrade pip
30+
uv pip install --system flake8 pyproject-flake8 mypy
31+
uv pip install --system -r pyproject.toml --all-extras
32+
33+
- name: Make scripts executable
34+
shell: bash
35+
run: |
36+
sudo chmod 755 ./scripts/download_install_dependencies.sh
37+
sudo chmod 755 ./scripts/build.sh
38+
39+
- name: Cache Boost
40+
id: cache-boost
41+
uses: actions/cache@v4
42+
with:
43+
path: boost
44+
key: ${{ inputs.os }}-cache-boost
45+
46+
- name: Download/Compile Boost
47+
shell: bash
48+
if: steps.cache-boost.outputs.cache-hit != 'true'
49+
run: |
50+
sudo ./scripts/download_install_dependencies.sh boost compile
51+
52+
- name: Cache Capnp
53+
id: cache-capnp
54+
uses: actions/cache@v4
55+
with:
56+
path: capnp
57+
key: ${{ inputs.os }}-cache-capnp
58+
59+
- name: Download/Compile Capnp
60+
shell: bash
61+
if: steps.cache-capnp.outputs.cache-hit != 'true'
62+
run: |
63+
sudo ./scripts/download_install_dependencies.sh capnp compile
64+
65+
- name: Install Boost
66+
shell: bash
67+
run: |
68+
sudo ./scripts/download_install_dependencies.sh boost install
69+
70+
- name: Install Capnp
71+
shell: bash
72+
run: |
73+
sudo ./scripts/download_install_dependencies.sh capnp install
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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: ubuntu-latest
16+
steps:
17+
- uses: ./.github/actions/checkout
18+
19+
- uses: ./.github/actions/setup-env
20+
with:
21+
os: ${{ runner.os }}
22+
23+
- uses: ./.github/actions/compile-library
24+
with:
25+
os: ${{ runner.os }}
26+
27+
- uses: ./.github/actions/run-linter
28+
29+
- uses: ./.github/actions/run-test
30+
31+
# build-win:
32+
# runs-on: windows-latest
33+
# steps:
34+
# - id: checkout
35+
# uses: ./.github/actions/checkout
36+
#
37+
# - name: Cache Boost
38+
# id: cache-boost-windows
39+
# uses: actions/cache@v4
40+
# with:
41+
# path: boost
42+
# key: ${{ runner.os }}-cache-boost
43+
#
44+
# - name: Download Boost if not cached
45+
# if: steps.cache-boost-windows.outputs.cache-hit != 'true'
46+
# run: |
47+
# ./scripts/download_install_dependencies.ps1 boost compile
48+
#
49+
# - name: Install Boost
50+
# run: |
51+
# ./scripts/download_install_dependencies.ps1 boost install
52+
#
53+
# - name: Cache Capnp
54+
# id: cache-capnp-windows
55+
# uses: actions/cache@v4
56+
# with:
57+
# path: capnp
58+
# key: ${{ runner.os }}-cache-capnp
59+
#
60+
# - name: Download and Compile capnp if not cached
61+
# if: steps.cache-capnp-windows.outputs.cache-hit != 'true'
62+
# run: |
63+
# ./scripts/download_install_dependencies.ps1 capnp compile
64+
#
65+
# - name: Install Capnp
66+
# run: |
67+
# ./scripts/download_install_dependencies.ps1 capnp install
68+
#
69+
# - name: Build and test C++ Components
70+
# run: |
71+
# cmake --preset windows-x64
72+
# cmake --build --preset windows-x64 --config Debug
73+
# cmake --install build_windows_x64 --config Debug
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)