From 8dfd99346d826d39197420b117bb08a9d726e0f3 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 30 Apr 2024 09:11:45 -0700 Subject: [PATCH 01/18] Adding MacOS unit tests --- .../{wintests.yaml => non_linux_tests.yaml} | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) rename .github/workflows/{wintests.yaml => non_linux_tests.yaml} (75%) diff --git a/.github/workflows/wintests.yaml b/.github/workflows/non_linux_tests.yaml similarity index 75% rename from .github/workflows/wintests.yaml rename to .github/workflows/non_linux_tests.yaml index 1ad83cf67..38a3cee95 100644 --- a/.github/workflows/wintests.yaml +++ b/.github/workflows/non_linux_tests.yaml @@ -1,4 +1,4 @@ -name: ARMI Windows tests +name: ARMI Non-Linux Tests on: push: @@ -9,9 +9,11 @@ on: - 'doc/**' jobs: - build: - - runs-on: windows-2022 + example_matrix: + strategy: + matrix: + os: [windows-2022, macos-12] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -21,7 +23,7 @@ jobs: python-version: '3.11' - name: Upgrade PIP run: python -m pip install --upgrade pip - - name: Run Unit Tests on Windows + - name: Run Unit Tests run: | pip install -e .[memprof,mpi,test] pytest -n 4 armi From 627a0e77dab7fcdcc153788d80f2359408669549 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 30 Apr 2024 09:29:34 -0700 Subject: [PATCH 02/18] Trying to get OpenMPI installed --- .../{non_linux_tests.yaml => mac_tests.yaml} | 13 ++++----- .github/workflows/win_tests.yaml | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) rename .github/workflows/{non_linux_tests.yaml => mac_tests.yaml} (75%) create mode 100644 .github/workflows/win_tests.yaml diff --git a/.github/workflows/non_linux_tests.yaml b/.github/workflows/mac_tests.yaml similarity index 75% rename from .github/workflows/non_linux_tests.yaml rename to .github/workflows/mac_tests.yaml index 38a3cee95..eb819c4f5 100644 --- a/.github/workflows/non_linux_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -1,4 +1,4 @@ -name: ARMI Non-Linux Tests +name: ARMI MacOS Tests on: push: @@ -9,11 +9,9 @@ on: - 'doc/**' jobs: - example_matrix: - strategy: - matrix: - os: [windows-2022, macos-12] - runs-on: ${{ matrix.os }} + build: + + runs-on: macos-12 steps: - uses: actions/checkout@v2 @@ -23,8 +21,9 @@ jobs: python-version: '3.11' - name: Upgrade PIP run: python -m pip install --upgrade pip - - name: Run Unit Tests + - name: Run Unit Tests on MacOS run: | + brew install openmpi pip install -e .[memprof,mpi,test] pytest -n 4 armi - name: Find Test Crumbs diff --git a/.github/workflows/win_tests.yaml b/.github/workflows/win_tests.yaml new file mode 100644 index 000000000..c8bb350ab --- /dev/null +++ b/.github/workflows/win_tests.yaml @@ -0,0 +1,29 @@ +name: ARMI Windows Tests + +on: + push: + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Upgrade PIP + run: python -m pip install --upgrade pip + - name: Run Unit Tests on Windows + run: | + pip install -e .[memprof,mpi,test] + pytest -n 4 armi + - name: Find Test Crumbs + run: python .github/workflows/find_test_crumbs.py From a72a73217203f70a50c354687e85c9bb4f5babb7 Mon Sep 17 00:00:00 2001 From: jstilley Date: Mon, 20 May 2024 16:02:11 -0700 Subject: [PATCH 03/18] TESTING: let's not run the mac tests in parallel --- .github/workflows/mac_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index eb819c4f5..86909d7f4 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -25,6 +25,6 @@ jobs: run: | brew install openmpi pip install -e .[memprof,mpi,test] - pytest -n 4 armi + pytest armi - name: Find Test Crumbs run: python .github/workflows/find_test_crumbs.py From 3f97d2f01ec4c8ba891530bcead9ce8bfe944e15 Mon Sep 17 00:00:00 2001 From: jstilley Date: Mon, 20 May 2024 16:50:09 -0700 Subject: [PATCH 04/18] Fixing test that was broke on MacOS --- armi/bookkeeping/report/reportingUtils.py | 27 ++++++++++++++++++++ armi/bookkeeping/report/tests/test_report.py | 8 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index b1a2291b6..b14b13f24 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -283,6 +283,31 @@ def _getSystemInfoWindows(): return subprocess.run(cmd, capture_output=True, text=True, shell=True).stdout +def _getSystemInfoMac(): + """Get system information, assuming the system is MacOS. + + Returns + ------- + str + Basic system information: OS name, OS version, basic processor information + + Examples + -------- + Example results: + + System Software Overview: + + System Version: macOS 12.1 (21C52) + Kernel Version: Darwin 21.2.0 + ... + Hardware Overview: + Model Name: MacBook Pro + ... + """ + cmd = "system_profiler SPSoftwareDataType SPHardwareDataType" + return subprocess.run(cmd, capture_output=True, text=True, shell=True).stdout + + def _getSystemInfoLinux(): """Get system information, assuming the system is Linux. @@ -369,6 +394,8 @@ def getSystemInfo(): return _getSystemInfoWindows() elif "linux" in sys.platform: return _getSystemInfoLinux() + elif "darwin" in sys.platform: + return _getSystemInfoMac() else: runLog.warning( f"Cannot get system information for {sys.platform} because ARMI only " diff --git a/armi/bookkeeping/report/tests/test_report.py b/armi/bookkeeping/report/tests/test_report.py index 87298060e..28e396349 100644 --- a/armi/bookkeeping/report/tests/test_report.py +++ b/armi/bookkeeping/report/tests/test_report.py @@ -16,6 +16,7 @@ import logging import os import subprocess +import sys import unittest from unittest.mock import patch @@ -98,7 +99,12 @@ def test_getSystemInfo(self): to fail if the test is run on some other OS. """ out = getSystemInfo() - substrings = ["OS ", "Processor(s):"] + + if "darwin" in sys.platform: + substrings = ["System Software", "Hardware Overview"] + else: + substrings = ["OS ", "Processor(s):"] + for sstr in substrings: self.assertIn(sstr, out) From 405b9f639fb76deab03aebd3564a203269e81139 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 10:42:58 -0700 Subject: [PATCH 05/18] Testing again --- .github/workflows/black.yaml | 18 ------- .github/workflows/coverage.yaml | 41 ---------------- .github/workflows/docs.yaml | 41 ---------------- .github/workflows/licensechecker.yaml | 9 ---- .github/workflows/linting.yaml | 21 --------- .github/workflows/unittests.yaml | 35 -------------- .github/workflows/validatemanifest.py | 57 ----------------------- .github/workflows/validatemanifest.yaml | 19 -------- .github/workflows/win_tests.yaml | 29 ------------ armi/bookkeeping/report/reportingUtils.py | 4 +- 10 files changed, 2 insertions(+), 272 deletions(-) delete mode 100644 .github/workflows/black.yaml delete mode 100644 .github/workflows/coverage.yaml delete mode 100644 .github/workflows/docs.yaml delete mode 100644 .github/workflows/licensechecker.yaml delete mode 100644 .github/workflows/linting.yaml delete mode 100644 .github/workflows/unittests.yaml delete mode 100644 .github/workflows/validatemanifest.py delete mode 100644 .github/workflows/validatemanifest.yaml delete mode 100644 .github/workflows/win_tests.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml deleted file mode 100644 index 5e8b698d6..000000000 --- a/.github/workflows/black.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: black - -on: [push, pull_request] - -# use workaround due to: https://github.com/psf/black/issues/2079#issuecomment-812359146 -jobs: - check-formatting: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.11 - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Install Black - run: pip install 'black==22.6.0' - - name: Run black --check . - run: black --check . diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index b3cd8de03..000000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Coverage - -on: - push: - branches: - - main - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - runs-on: ubuntu-22.04 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Update package index - run: sudo apt-get update - - name: Install ARMI and MPI - run: | - sudo apt-get -y install libopenmpi-dev - pip install -e .[memprof,mpi,test] - - name: Run Coverage - run: | - coverage run --rcfile=pyproject.toml -m pytest -n 4 --cov=armi --cov-config=pyproject.toml --cov-report=lcov --ignore=venv armi - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true - coverage combine --rcfile=pyproject.toml --keep -a - - name: Publish to coveralls.io - uses: coverallsapp/github-action@v1.1.2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: coverage.lcov diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml deleted file mode 100644 index 8f7f1a0cf..000000000 --- a/.github/workflows/docs.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Documentation - -on: - push: - branches: - - main - -jobs: - build: - - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Update package index - run: sudo apt-get update - - name: Install mpi libs - run: sudo apt-get -y install libopenmpi-dev - - name: Install Pandoc - run: sudo apt-get -y install pandoc - - name: Setup Graphviz - uses: ts-graphviz/setup-graphviz@v2.0.2 - - name: Make HTML Docs - run: | - pip install -e .[memprof,mpi,test,docs] - cd doc - git submodule init - git submodule update - make html - - name: deploy - uses: JamesIves/github-pages-deploy-action@v4.6.1 - with: - token: ${{ secrets.ACCESS_TOKEN }} - repository-name: ${{ github.repository_owner }}/terrapower.github.io - branch: main - folder: doc/_build/html - target-folder: armi diff --git a/.github/workflows/licensechecker.yaml b/.github/workflows/licensechecker.yaml deleted file mode 100644 index abeee0e47..000000000 --- a/.github/workflows/licensechecker.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: Check License Lines -on: [push, pull_request] -jobs: - check-license-lines: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@master - - name: Check License Lines - uses: kt3k/license_checker@v1.0.6 diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml deleted file mode 100644 index 855b4b6cf..000000000 --- a/.github/workflows/linting.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Linting - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Update package index - run: sudo apt-get update - - name: Run Linter - run: | - pip install -e .[test] - ruff . diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml deleted file mode 100644 index 15c0b2364..000000000 --- a/.github/workflows/unittests.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: ARMI unit tests - -on: - push: - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - - runs-on: ubuntu-22.04 - strategy: - matrix: - python: [3.7, 3.8, 3.9, '3.10', '3.11'] - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Update package index - run: sudo apt-get update - - name: Install mpi libs - run: sudo apt-get -y install libopenmpi-dev - - name: Run Tests and Coverage - run: | - pip install -e .[memprof,mpi,test] - pytest -n 4 armi - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true - mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true - coverage combine --rcfile=pyproject.toml --keep -a diff --git a/.github/workflows/validatemanifest.py b/.github/workflows/validatemanifest.py deleted file mode 100644 index 2e1fd901a..000000000 --- a/.github/workflows/validatemanifest.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2022 TerraPower, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Validating the package-data in the pyproject.toml. - -Validate that we aren't trying to include files that don't exist. -""" - -from glob import glob -import os -import toml - -# CONSTANTS -ARMI_DIR = "armi/" -PRPROJECT = "pyproject.toml" - - -def main(): - # parse the data files out of the pyproject.toml - txt = open(PRPROJECT, "r").read() - data = toml.loads(txt) - fileChunks = data["tool"]["setuptools"]["package-data"]["armi"] - - # loop through each line in the package-data and find all the file paths - errors = [] - for i, line in enumerate(fileChunks): - # make sure the file exists - path = ARMI_DIR + line.strip() - if "*" in path: - paths = [f for f in glob(path) if len(f) > 3] - if not len(paths): - errors.append((i, path)) - else: - if not os.path.exists(path): - errors.append((i, path)) - - # If there were any missing files, raise an Error. - if errors: - for (i, line) in errors: - print("Nonexistant file on line {}: {}".format(i, line)) - raise ValueError("Package-data file is incorrect: includes non-existant files.") - - -if __name__ == "__main__": - main() diff --git a/.github/workflows/validatemanifest.yaml b/.github/workflows/validatemanifest.yaml deleted file mode 100644 index acd640208..000000000 --- a/.github/workflows/validatemanifest.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Validate Manifest - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Validate Manifest - run: | - pip install toml - python .github/workflows/validatemanifest.py diff --git a/.github/workflows/win_tests.yaml b/.github/workflows/win_tests.yaml deleted file mode 100644 index c8bb350ab..000000000 --- a/.github/workflows/win_tests.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: ARMI Windows Tests - -on: - push: - paths-ignore: - - 'doc/**' - pull_request: - paths-ignore: - - 'doc/**' - -jobs: - build: - - runs-on: windows-2022 - - steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - name: Upgrade PIP - run: python -m pip install --upgrade pip - - name: Run Unit Tests on Windows - run: | - pip install -e .[memprof,mpi,test] - pytest -n 4 armi - - name: Find Test Crumbs - run: python .github/workflows/find_test_crumbs.py diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index b14b13f24..038c81135 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -304,7 +304,7 @@ def _getSystemInfoMac(): Model Name: MacBook Pro ... """ - cmd = "system_profiler SPSoftwareDataType SPHardwareDataType" + cmd = "system_profiler" return subprocess.run(cmd, capture_output=True, text=True, shell=True).stdout @@ -399,7 +399,7 @@ def getSystemInfo(): else: runLog.warning( f"Cannot get system information for {sys.platform} because ARMI only " - + "supports Linux and Windows." + + "supports Linux, Windows, and MacOS." ) return "" From 4201777542d823f0a038bdd3083f8c848025bd35 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 14:22:16 -0700 Subject: [PATCH 06/18] This is so odd --- .github/workflows/mac_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index 86909d7f4..20c3b6206 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -25,6 +25,6 @@ jobs: run: | brew install openmpi pip install -e .[memprof,mpi,test] - pytest armi + pytest -x armi/bookkeeping/report - name: Find Test Crumbs run: python .github/workflows/find_test_crumbs.py From 75c09bd53bd000b1d098b45edb5ed3892c24f776 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 15:30:20 -0700 Subject: [PATCH 07/18] Install system profiler --- .github/workflows/mac_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index 20c3b6206..a05cc2bd7 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -24,6 +24,7 @@ jobs: - name: Run Unit Tests on MacOS run: | brew install openmpi + brew install system_profiler pip install -e .[memprof,mpi,test] pytest -x armi/bookkeeping/report - name: Find Test Crumbs From e16df63530d54406a35bb4145db9713c91e095c5 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 15:36:26 -0700 Subject: [PATCH 08/18] stuff --- armi/bookkeeping/report/reportingUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index 038c81135..96bbdf4ce 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -304,7 +304,7 @@ def _getSystemInfoMac(): Model Name: MacBook Pro ... """ - cmd = "system_profiler" + cmd = "ioreg" return subprocess.run(cmd, capture_output=True, text=True, shell=True).stdout From 7c178404d60e580bc090de8497fa136eebe9692a Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 15:39:24 -0700 Subject: [PATCH 09/18] whoops --- .github/workflows/mac_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index a05cc2bd7..20c3b6206 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -24,7 +24,6 @@ jobs: - name: Run Unit Tests on MacOS run: | brew install openmpi - brew install system_profiler pip install -e .[memprof,mpi,test] pytest -x armi/bookkeeping/report - name: Find Test Crumbs From f9758acbb8708a0fd68e05ad818362e54ef9be2f Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 16:03:25 -0700 Subject: [PATCH 10/18] Let's try this --- armi/bookkeeping/report/reportingUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index 96bbdf4ce..09d4464cf 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -305,7 +305,7 @@ def _getSystemInfoMac(): ... """ cmd = "ioreg" - return subprocess.run(cmd, capture_output=True, text=True, shell=True).stdout + return subprocess.check_output(cmd, shell=True).decode("utf-8") def _getSystemInfoLinux(): From 2e625876752810af715c4a7c25f8cbb2de864b85 Mon Sep 17 00:00:00 2001 From: jstilley Date: Tue, 21 May 2024 16:07:45 -0700 Subject: [PATCH 11/18] Or this? --- armi/bookkeeping/report/reportingUtils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index 09d4464cf..894dcaf1c 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -304,7 +304,7 @@ def _getSystemInfoMac(): Model Name: MacBook Pro ... """ - cmd = "ioreg" + cmd = "system_profiler" return subprocess.check_output(cmd, shell=True).decode("utf-8") From 838a971b06da28f0d51a2794b351d757fd160cd7 Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 13:40:53 -0700 Subject: [PATCH 12/18] Okay, big changes --- .github/workflows/mac_tests.yaml | 4 +-- armi/bookkeeping/report/reportingUtils.py | 2 +- armi/bookkeeping/report/tests/test_report.py | 28 ++++++++++++++++---- doc/user/inputs.rst | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index 20c3b6206..28a4fda10 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -11,7 +11,7 @@ on: jobs: build: - runs-on: macos-12 + runs-on: macos-14 steps: - uses: actions/checkout@v2 @@ -26,5 +26,3 @@ jobs: brew install openmpi pip install -e .[memprof,mpi,test] pytest -x armi/bookkeeping/report - - name: Find Test Crumbs - run: python .github/workflows/find_test_crumbs.py diff --git a/armi/bookkeeping/report/reportingUtils.py b/armi/bookkeeping/report/reportingUtils.py index 894dcaf1c..c8526cdda 100644 --- a/armi/bookkeeping/report/reportingUtils.py +++ b/armi/bookkeeping/report/reportingUtils.py @@ -304,7 +304,7 @@ def _getSystemInfoMac(): Model Name: MacBook Pro ... """ - cmd = "system_profiler" + cmd = "system_profiler SPSoftwareDataType SPHardwareDataType" return subprocess.check_output(cmd, shell=True).decode("utf-8") diff --git a/armi/bookkeeping/report/tests/test_report.py b/armi/bookkeeping/report/tests/test_report.py index 28e396349..2d78be90c 100644 --- a/armi/bookkeeping/report/tests/test_report.py +++ b/armi/bookkeeping/report/tests/test_report.py @@ -25,6 +25,7 @@ from armi.bookkeeping.report import data, reportInterface from armi.bookkeeping.report.reportingUtils import ( _getSystemInfoLinux, + _getSystemInfoMac, _getSystemInfoWindows, getNodeName, getSystemInfo, @@ -92,18 +93,35 @@ def test_getSystemInfoWindows(self, mockSubprocess): out = _getSystemInfoWindows() self.assertEqual(out, windowsResult) + @patch("subprocess.run") + def test_getSystemInfoMac(self, mockSubprocess): + """Test _getSystemInfoMac() on any operating system, by mocking the system call.""" + macResult = """System Software Overview: + + System Version: macOS 12.1 (21C52) + Kernel Version: Darwin 21.2.0 + ... + Hardware Overview: + Model Name: MacBook Pro + ...""" + + mockSubprocess.return_value = _MockReturnResult(macResult) + + out = _getSystemInfoMac() + self.assertEqual(out, macResult) + def test_getSystemInfo(self): """Basic sanity check of getSystemInfo() running in the wild. This test should pass if it is run on Window or mainstream Linux distros. But we expect this to fail if the test is run on some other OS. """ - out = getSystemInfo() - if "darwin" in sys.platform: - substrings = ["System Software", "Hardware Overview"] - else: - substrings = ["OS ", "Processor(s):"] + # too comlicated to test MacOS in this method + return + + out = getSystemInfo() + substrings = ["OS ", "Processor(s):"] for sstr in substrings: self.assertIn(sstr, out) diff --git a/doc/user/inputs.rst b/doc/user/inputs.rst index 3cc3916a6..fda2d0726 100644 --- a/doc/user/inputs.rst +++ b/doc/user/inputs.rst @@ -478,7 +478,7 @@ The ARMI data model is represented schematically below, and the blueprints are d Defines :py:class:`~armi.reactor.components.component.Component` inputs for a :py:class:`~armi.reactor.blocks.Block`. -:ref:`asssemblies `: +:ref:`assemblies `: Defines vertical stacks of blocks used to define the axial profile of an :py:class:`~armi.reactor.assemblies.Assembly`. From 1c5aba1df617f11202110470bea9e3956abdaf3b Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 13:46:35 -0700 Subject: [PATCH 13/18] Fixing test issue --- armi/bookkeeping/report/tests/test_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armi/bookkeeping/report/tests/test_report.py b/armi/bookkeeping/report/tests/test_report.py index 2d78be90c..9d70fce63 100644 --- a/armi/bookkeeping/report/tests/test_report.py +++ b/armi/bookkeeping/report/tests/test_report.py @@ -96,7 +96,7 @@ def test_getSystemInfoWindows(self, mockSubprocess): @patch("subprocess.run") def test_getSystemInfoMac(self, mockSubprocess): """Test _getSystemInfoMac() on any operating system, by mocking the system call.""" - macResult = """System Software Overview: + macResult = b"""System Software Overview: System Version: macOS 12.1 (21C52) Kernel Version: Darwin 21.2.0 @@ -108,7 +108,7 @@ def test_getSystemInfoMac(self, mockSubprocess): mockSubprocess.return_value = _MockReturnResult(macResult) out = _getSystemInfoMac() - self.assertEqual(out, macResult) + self.assertEqual(out, macResult.decode("utf-8")) def test_getSystemInfo(self): """Basic sanity check of getSystemInfo() running in the wild. From 9268ff2d44d86f5a37db6294d1e9965e9a6cbb6d Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 13:49:06 -0700 Subject: [PATCH 14/18] Let's run ALL the tests on MacOS --- .github/workflows/mac_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index 28a4fda10..ac0a0dd7d 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -25,4 +25,4 @@ jobs: run: | brew install openmpi pip install -e .[memprof,mpi,test] - pytest -x armi/bookkeeping/report + pytest -x armi From 5453c101275e3881c22100de36867a8acf83dd3c Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 14:12:20 -0700 Subject: [PATCH 15/18] Adding release notes --- doc/release/0.3.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release/0.3.rst b/doc/release/0.3.rst index 6ed9df78b..8c236a780 100644 --- a/doc/release/0.3.rst +++ b/doc/release/0.3.rst @@ -55,6 +55,7 @@ Bug Fixes Quality Work ------------ +#. Supporting MacOS in CI. (`PR#1713 `_) #. We now enforce a maximum line length of 120 characters, using ``ruff``. (`PR#1646 `_) #. Move ``.coveragerc`` file information into ``pyproject.toml``. (`PR#1692 `_) #. TBD From 837fb8e730d1de2bde3d08deaca7fc8724383b65 Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 14:55:19 -0700 Subject: [PATCH 16/18] Reverting to main --- .github/workflows/black.yaml | 18 ++++++++ .github/workflows/coverage.yaml | 41 ++++++++++++++++++ .github/workflows/docs.yaml | 41 ++++++++++++++++++ .github/workflows/licensechecker.yaml | 9 ++++ .github/workflows/linting.yaml | 21 +++++++++ .github/workflows/unittests.yaml | 35 +++++++++++++++ .github/workflows/validatemanifest.py | 57 +++++++++++++++++++++++++ .github/workflows/validatemanifest.yaml | 19 +++++++++ 8 files changed, 241 insertions(+) create mode 100644 .github/workflows/black.yaml create mode 100644 .github/workflows/coverage.yaml create mode 100644 .github/workflows/docs.yaml create mode 100644 .github/workflows/licensechecker.yaml create mode 100644 .github/workflows/linting.yaml create mode 100644 .github/workflows/unittests.yaml create mode 100644 .github/workflows/validatemanifest.py create mode 100644 .github/workflows/validatemanifest.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 000000000..5e8b698d6 --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,18 @@ +name: black + +on: [push, pull_request] + +# use workaround due to: https://github.com/psf/black/issues/2079#issuecomment-812359146 +jobs: + check-formatting: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Install Black + run: pip install 'black==22.6.0' + - name: Run black --check . + run: black --check . diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 000000000..b3cd8de03 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,41 @@ +name: Coverage + +on: + push: + branches: + - main + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + runs-on: ubuntu-22.04 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Update package index + run: sudo apt-get update + - name: Install ARMI and MPI + run: | + sudo apt-get -y install libopenmpi-dev + pip install -e .[memprof,mpi,test] + - name: Run Coverage + run: | + coverage run --rcfile=pyproject.toml -m pytest -n 4 --cov=armi --cov-config=pyproject.toml --cov-report=lcov --ignore=venv armi + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true + coverage combine --rcfile=pyproject.toml --keep -a + - name: Publish to coveralls.io + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: coverage.lcov diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..8f7f1a0cf --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,41 @@ +name: Documentation + +on: + push: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Update package index + run: sudo apt-get update + - name: Install mpi libs + run: sudo apt-get -y install libopenmpi-dev + - name: Install Pandoc + run: sudo apt-get -y install pandoc + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v2.0.2 + - name: Make HTML Docs + run: | + pip install -e .[memprof,mpi,test,docs] + cd doc + git submodule init + git submodule update + make html + - name: deploy + uses: JamesIves/github-pages-deploy-action@v4.6.1 + with: + token: ${{ secrets.ACCESS_TOKEN }} + repository-name: ${{ github.repository_owner }}/terrapower.github.io + branch: main + folder: doc/_build/html + target-folder: armi diff --git a/.github/workflows/licensechecker.yaml b/.github/workflows/licensechecker.yaml new file mode 100644 index 000000000..abeee0e47 --- /dev/null +++ b/.github/workflows/licensechecker.yaml @@ -0,0 +1,9 @@ +name: Check License Lines +on: [push, pull_request] +jobs: + check-license-lines: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@master + - name: Check License Lines + uses: kt3k/license_checker@v1.0.6 diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml new file mode 100644 index 000000000..855b4b6cf --- /dev/null +++ b/.github/workflows/linting.yaml @@ -0,0 +1,21 @@ +name: Linting + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Update package index + run: sudo apt-get update + - name: Run Linter + run: | + pip install -e .[test] + ruff . diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml new file mode 100644 index 000000000..15c0b2364 --- /dev/null +++ b/.github/workflows/unittests.yaml @@ -0,0 +1,35 @@ +name: ARMI unit tests + +on: + push: + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + + runs-on: ubuntu-22.04 + strategy: + matrix: + python: [3.7, 3.8, 3.9, '3.10', '3.11'] + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Update package index + run: sudo apt-get update + - name: Install mpi libs + run: sudo apt-get -y install libopenmpi-dev + - name: Run Tests and Coverage + run: | + pip install -e .[memprof,mpi,test] + pytest -n 4 armi + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiFeatures.py || true + mpiexec -n 2 --use-hwthread-cpus coverage run --rcfile=pyproject.toml -m pytest --cov=armi --cov-config=pyproject.toml --cov-report=lcov --cov-append --ignore=venv armi/tests/test_mpiParameters.py || true + coverage combine --rcfile=pyproject.toml --keep -a diff --git a/.github/workflows/validatemanifest.py b/.github/workflows/validatemanifest.py new file mode 100644 index 000000000..2e1fd901a --- /dev/null +++ b/.github/workflows/validatemanifest.py @@ -0,0 +1,57 @@ +# Copyright 2022 TerraPower, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Validating the package-data in the pyproject.toml. + +Validate that we aren't trying to include files that don't exist. +""" + +from glob import glob +import os +import toml + +# CONSTANTS +ARMI_DIR = "armi/" +PRPROJECT = "pyproject.toml" + + +def main(): + # parse the data files out of the pyproject.toml + txt = open(PRPROJECT, "r").read() + data = toml.loads(txt) + fileChunks = data["tool"]["setuptools"]["package-data"]["armi"] + + # loop through each line in the package-data and find all the file paths + errors = [] + for i, line in enumerate(fileChunks): + # make sure the file exists + path = ARMI_DIR + line.strip() + if "*" in path: + paths = [f for f in glob(path) if len(f) > 3] + if not len(paths): + errors.append((i, path)) + else: + if not os.path.exists(path): + errors.append((i, path)) + + # If there were any missing files, raise an Error. + if errors: + for (i, line) in errors: + print("Nonexistant file on line {}: {}".format(i, line)) + raise ValueError("Package-data file is incorrect: includes non-existant files.") + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/validatemanifest.yaml b/.github/workflows/validatemanifest.yaml new file mode 100644 index 000000000..acd640208 --- /dev/null +++ b/.github/workflows/validatemanifest.yaml @@ -0,0 +1,19 @@ +name: Validate Manifest + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Validate Manifest + run: | + pip install toml + python .github/workflows/validatemanifest.py From 325a8fc02582ecea2bfb01f22986e1c7d83bd99d Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 15:12:28 -0700 Subject: [PATCH 17/18] Adding windows tests back. Drat --- .github/workflows/wintests.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/wintests.yaml diff --git a/.github/workflows/wintests.yaml b/.github/workflows/wintests.yaml new file mode 100644 index 000000000..1ad83cf67 --- /dev/null +++ b/.github/workflows/wintests.yaml @@ -0,0 +1,29 @@ +name: ARMI Windows tests + +on: + push: + paths-ignore: + - 'doc/**' + pull_request: + paths-ignore: + - 'doc/**' + +jobs: + build: + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Upgrade PIP + run: python -m pip install --upgrade pip + - name: Run Unit Tests on Windows + run: | + pip install -e .[memprof,mpi,test] + pytest -n 4 armi + - name: Find Test Crumbs + run: python .github/workflows/find_test_crumbs.py From 7fbf9edc5438f57e4bcf9296c9e135683990bb0e Mon Sep 17 00:00:00 2001 From: jstilley Date: Thu, 23 May 2024 15:47:44 -0700 Subject: [PATCH 18/18] Whoops, this was just for my testing --- .github/workflows/mac_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac_tests.yaml b/.github/workflows/mac_tests.yaml index ac0a0dd7d..77da1919c 100644 --- a/.github/workflows/mac_tests.yaml +++ b/.github/workflows/mac_tests.yaml @@ -25,4 +25,4 @@ jobs: run: | brew install openmpi pip install -e .[memprof,mpi,test] - pytest -x armi + pytest armi