Skip to content

Commit

Permalink
Reverting to main
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed May 23, 2024
1 parent 5453c10 commit 837fb8e
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -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 .
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
41 changes: 41 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- 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/[email protected]
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository-name: ${{ github.repository_owner }}/terrapower.github.io
branch: main
folder: doc/_build/html
target-folder: armi
9 changes: 9 additions & 0 deletions .github/workflows/licensechecker.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
21 changes: 21 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -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 .
35 changes: 35 additions & 0 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
@@ -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
57 changes: 57 additions & 0 deletions .github/workflows/validatemanifest.py
Original file line number Diff line number Diff line change
@@ -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()
19 changes: 19 additions & 0 deletions .github/workflows/validatemanifest.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 837fb8e

Please sign in to comment.