Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 73 additions & 54 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,94 @@
name: Build and publish pyfactxx
name: Build and publish pyfactxx

on:
release:
types: [created]

permissions:
contents: read # access to check out code and install dependencies

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-20.04", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: ["ubuntu-22.04", "windows-2025"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
defaults:
run:
working-directory: ./FaCT++.Python

steps:
- uses: actions/checkout@v3
- uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel auditwheel scikit-build cmake cython
- name: Build a wheel
run: |
python setup.py bdist_wheel
- name: Audit a wheel
if: runner.os == 'Linux'
run: |
auditwheel repair --plat manylinux_2_27_x86_64 dist/*
rm -rf dist/*
mv wheelhouse/* dist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-${{ matrix.python-version }}
path: FaCT++.Python/dist/pyfactxx*
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: "24"
# TODO: migrate to the upstream
- uses: knopki/msvc-dev-cmd@221ec3af3b87c0c8189236347c1c0788d2022272
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel scikit-build cmake cython
- name: Install Linux-only dependencies
if: runner.os == 'Linux'
run: |
pip install auditwheel patchelf
- name: Build a wheel
run: |
python setup.py bdist_wheel
- name: Audit a wheel
if: runner.os == 'Linux'
run: |
auditwheel repair --plat manylinux_2_34_x86_64 dist/*whl
rm -rf dist/*
mv wheelhouse/* dist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ matrix.python-version }}
path: FaCT++.Python/dist/pyfactxx*

publish:
runs-on: ubuntu-latest
needs: build
runs-on: ubuntu-24.04
needs: build
defaults:
run:
working-directory: ./FaCT++.Python
environment:
name: pypi
url: https://pypi.org/p/pyfactxx
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel auditwheel scikit-build cmake cython
- name: Build a source distribution
run: |
python setup.py sdist
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: FaCT++.Python/wheels/
- name: Move wheels
run: |
mv wheels/*/*.whl dist/
- name: Publish packages
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: FaCT++.Python/dist
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel scikit-build cmake cython
- name: Build a source distribution
run: |
python setup.py sdist
- name: Download artifacts
uses: actions/download-artifact@v5
with:
path: FaCT++.Python/wheels/
- name: Move wheels
run: |
mv wheels/*/*.whl dist/
- name: Publish packages
uses: pypa/[email protected]
with:
packages-dir: FaCT++.Python/dist/
# # useful for testing:
# verbose: true
# repository-url: https://test.pypi.org/legacy/
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
23 changes: 12 additions & 11 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@ name: Build and test pyfactxx
on:
workflow_dispatch:
push:
branches: [ $default-branch, "wheels" ]
branches: [master, "wheels"]
pull_request:
branches: [ $default-branch, "wheels" ]
branches: [master, "wheels"]

permissions:
contents: read # access to check out code and install dependencies

jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
defaults:
run:
working-directory: ./FaCT++.Python
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scikit-build cmake cython pytest pytest-cov
pip install pytest pytest-cov
- name: Install package
working-directory: ./FaCT++.Python
run: |
pip install -e .
pip install .
- name: Test with pytest
run: |
pytest FaCT++.Python
pytest
14 changes: 9 additions & 5 deletions .github/workflows/codacy-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Codacy Security Scan

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '32 23 * * 5'
- cron: "32 23 * * 5"

jobs:
codacy-security-scan:
Expand All @@ -16,7 +16,7 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v5

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
Expand All @@ -36,6 +36,10 @@ jobs:

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v4
# Codacy is broken now
# https://github.com/codacy/codacy-analysis-cli/issues/541
continue-on-error: true
with:
sarif_file: results.sarif
wait-for-processing: true
80 changes: 44 additions & 36 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '30 3 * * 0'
- cron: "30 3 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
Expand All @@ -21,37 +21,45 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'java', 'python' ]
language: ["cpp", "java", "python"]

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
if: matrix.language != 'cpp'
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

- name: Install dependencies
if: matrix.language == 'cpp'
run: |
sudo apt-get update
sudo apt-get install cmake default-jdk
- name: Build
if: matrix.language == 'cpp'
run: |
cmake .
make

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.15)
project(factplusplus)

# global definition
Expand Down
2 changes: 1 addition & 1 deletion FaCT++.C/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.15)

set(SOURCE_FILES
fact.cpp
Expand Down
2 changes: 1 addition & 1 deletion FaCT++.JNI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.15)

# We are using JNI and need to #include <jni.h>
find_package(JNI REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions FaCT++.Python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ __pycache__/
dist/
MANIFEST

# cythonized files
pyfactxx/*.cpp
pyfactxx/*.so
# cythonized files
src/*.cpp
src/*.so

# scikit-build files
_skbuild/
10 changes: 6 additions & 4 deletions FaCT++.Python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
set(CMAKE_VERBOSE_MAKEFILE ON)
cmake_minimum_required(VERSION 3.13.0)
cmake_minimum_required(VERSION 3.15)
set(CMAKE_CXX_STANDARD 11)
find_program(PYTHON "python")

set(Python_FIND_VIRTUALENV FIRST)
find_package(Python3 COMPONENTS Interpreter)

if (PYTHON)

file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pyfactxx/__init__.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/src/__init__.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")

add_custom_command(OUTPUT ${OUTPUT}
Expand All @@ -19,4 +21,4 @@ if (PYTHON)
add_custom_target(pyfactxx-build ALL DEPENDS ${OUTPUT})

install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
endif()
endif()
Loading