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