From 8b6b6eef0500832d8d2c1b0680b8464252f56772 Mon Sep 17 00:00:00 2001 From: Nate Kupp Date: Sat, 28 Jun 2025 07:46:10 -0700 Subject: [PATCH 1/4] Replace Travis CI with Github Actions --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 25 -------------------- README.md | 2 +- 3 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..459704e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9, 3.10, 3.11, 3.12, 3.13] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r dev-requirements.txt + pip install -e . + + - name: Set PYTHONPATH + run: echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV + + - name: Run validation + run: | + if [ -z "$NOVALIDATE" ]; then + make validate + else + echo "skipping validate" + fi + + - name: Run tests with coverage + run: pytest --cov ffx + + - name: Upload coverage to Coveralls + if: matrix.python-version == '3.11' + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + coveralls-endpoint: https://coveralls.io \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3626526..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: python - -jobs: - include: - - python: "3.7" - - python: "3.8" - - python: "3.9" - - python: "3.10" - - python: "3.11" - - python: "3.12" - - python: "3.13" - -install: - - pip install -r dev-requirements.txt - - pip install -e . - -before_script: - - export PYTHONPATH=$(pwd):$PYTHONPATH; - -script: - - '[ -z "$NOVALIDATE" ] && make validate || echo "skipping validate"' - - pytest --cov ffx - -after_success: - - coveralls diff --git a/README.md b/README.md index e2b83b8..a50f036 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FFX: Fast Function Extraction -[![Build Status at Travis CI](https://travis-ci.org/natekupp/ffx.svg?branch=master)](https://travis-ci.org/natekupp/ffx) +[![CI](https://github.com/natekupp/ffx/workflows/CI/badge.svg)](https://github.com/natekupp/ffx/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/github/natekupp/ffx/badge.svg?branch=master)](https://coveralls.io/github/natekupp/ffx?branch=master) FFX is a technique for symbolic regression. It is: From 0d087b84d701fb68c884b9f17d59b413d9f766ff Mon Sep 17 00:00:00 2001 From: Nate Kupp Date: Sat, 28 Jun 2025 07:49:49 -0700 Subject: [PATCH 2/4] up --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 459704e..4151887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9, 3.10, 3.11, 3.12, 3.13] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 From d7677487b57362c162f05409d9f18d04c85bfa13 Mon Sep 17 00:00:00 2001 From: Nate Kupp Date: Sat, 28 Jun 2025 07:50:53 -0700 Subject: [PATCH 3/4] up --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4151887..93830d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 From df4ba91f5381d39c9e97c4ff01325e956e0035be Mon Sep 17 00:00:00 2001 From: Nate Kupp Date: Sat, 28 Jun 2025 07:54:14 -0700 Subject: [PATCH 4/4] up --- ffx/time_utils.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/ffx/time_utils.py b/ffx/time_utils.py index cfb8db1..0e60ad9 100644 --- a/ffx/time_utils.py +++ b/ffx/time_utils.py @@ -1,21 +1,13 @@ -import os import signal -import sys import time from contextlib import contextmanager from functools import wraps - -if sys.version_info.major >= 3 and sys.version_info.minor >= 3: - time_fn = time.perf_counter -elif os.name == 'nt': - time_fn = time.clock -else: - time_fn = time.time +from builtins import TimeoutError class TimerResult: def __init__(self): - self.start_time = time_fn() + self.start_time = time.perf_counter() self.end_time = None @property @@ -29,7 +21,7 @@ def millis(self): @contextmanager def time_execution_scope(): - '''Usage: + """Usage: with time_execution_scope() as timer_result: do_some_operation() @@ -39,18 +31,11 @@ def time_execution_scope(): timer_result=timer_result ) ) - ''' + """ timer_result = TimerResult() yield timer_result - timer_result.end_time = time_fn() - - -try: - from builtins import TimeoutError # pylint: disable=unused-import -except ImportError: - # TimeoutError was introduced in python 3.3+ - TimeoutError = OSError + timer_result.end_time = time.perf_counter() def timeout(seconds_before_timeout):