Skip to content

Commit

Permalink
Add cython-lint, fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Dec 10, 2023
1 parent ee2a6f3 commit 07da094
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 35 deletions.
71 changes: 45 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
PYNUCLEUS_BUILD_PARALLELISM: 2
OMPI_CC: ${{ matrix.c-compiler }}
OMPI_CXX: ${{ matrix.cxx-compiler }}
BUILD_PRETTY_IDENTIFIER: "Linux ${{ matrix.c-compiler }} Python ${{ matrix.py-version }}"
BUILD_IDENTIFIER: "Linux-${{ matrix.c-compiler }}-${{ matrix.py-version }}"

steps:
- name: Check out repo
Expand All @@ -45,7 +47,7 @@ jobs:
uses: actions/cache/restore@v3
with:
path: /home/runner/.cache/ccache
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}
key: ccache-${{ env.BUILD_IDENTIFIER }}

- uses: actions/setup-python@v4
if: always()
Expand Down Expand Up @@ -77,52 +79,53 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete ccache-${{ runner.os }}-${{ matrix.c-compiler}}-${{ matrix.py-version }} --confirm
gh actions-cache delete ccache-${{ env.BUILD_IDENTIFIER }} --confirm
continue-on-error: true

- name: Push ccache cache
if: always()
uses: actions/cache/save@v3
with:
path: /home/runner/.cache/ccache
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}
key: ccache-${{ env.BUILD_IDENTIFIER }}

- name: Ccache report
if: always()
run: ccache -s

- name: Run tests
if: always()
run: python3 -m pytest --junit-xml=test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml tests/
run: python3 -m pytest --junit-xml=test-results-${{ env.BUILD_IDENTIFIER }}.xml tests/

- name: Run flake8
if: always()
run: |
make flake8
mv flake8.xml flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
mv flake8.xml flake8-${{ env.BUILD_IDENTIFIER }}.xml
- name: Archive test results
uses: actions/upload-artifact@v3
- name: Run cython-lint
if: always()
with:
name: Test results
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
run: |
make cython-lint
mv cython-lint.xml cython-lint-${{ env.BUILD_IDENTIFIER }}.xml
- name: Report test results
uses: dorny/test-reporter@v1
- name: Archive results
uses: actions/upload-artifact@v3
if: always()
with:
name: Test report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
reporter: java-junit
fail-on-error: true
name: Results (${{ env.BUILD_PRETTY_IDENTIFIER }})
path: |
test-results-${{ env.BUILD_IDENTIFIER }}.xml
flake8-${{ env.BUILD_IDENTIFIER }}.xml
cython-lint-${{ env.BUILD_IDENTIFIER }}.xml
- name: Report flake8 results
- name: Report results
uses: dorny/test-reporter@v1
if: always()
with:
name: Flake8 report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
path: flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
name: Report (${{ env.BUILD_PRETTY_IDENTIFIER }})
path: |
*-${{ env.BUILD_IDENTIFIER }}.xml
reporter: java-junit
fail-on-error: false

Expand Down Expand Up @@ -204,18 +207,34 @@ jobs:
if: always()
run: python3 -m pytest --junit-xml=test-results-${{ runner.os }}-${{ matrix.py-version }}.xml tests/

- name: Archive test results
- name: Run flake8
if: always()
run: |
make flake8
mv flake8.xml flake8-${{ runner.os }}-${{ matrix.py-version }}.xml
- name: Run cython-lint
if: always()
run: |
make cython-lint
mv cython-lint.xml cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml
- name: Archive results
uses: actions/upload-artifact@v3
if: always()
with:
name: Test results
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
name: Results ${{ github.job }}
path: |
test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
flake8-${{ runner.os }}-${{ matrix.py-version }}.xml
cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml
- name: Report test results
- name: Report results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test report (${{ runner.os }}, Python ${{ matrix.py-version }})
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
name: Report (${{ github.job }})
path: |
*-${{ runner.os }}-${{ matrix.py-version }}.xml
reporter: java-junit
fail-on-error: true
fail-on-error: false
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ENV VIRTUAL_ENV=/pynucleus/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
WORKDIR /pynucleus
RUN make prereq && \
make prereq-extra && \
RUN make prereq PIP_FLAGS=--no-cache-dir && \
make prereq-extra PIP_FLAGS=--no-cache-dir && \
make install && \
python -m pip install --no-cache-dir ipykernel && \
rm -rf build packageTools/build base/build metisCy/build fem/build multilevelSolver/build nl/build
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,16 @@ prereq:
$(PYTHON) -m pip install $(PIP_FLAGS) $(PIP_INSTALL_FLAGS) scikit-sparse

prereq-extra:
$(PYTHON) -m pip install $(PIP_FLAGS) pytest pytest-html pytest-xdist Sphinx sphinxcontrib-programoutput flake8 flake8-junit-report
$(PYTHON) -m pip install $(PIP_FLAGS) pytest pytest-html pytest-xdist Sphinx sphinxcontrib-programoutput flake8 flake8-junit-report cython-lint

flake8:
$(PYTHON) -m flake8 --output-file=flake8.txt --exit-zero drivers packageTools base metisCy fem multilevelSolver nl tests
$(PYTHON) -m flake8 --output-file=flake8.txt --exit-zero drivers examples packageTools base metisCy fem multilevelSolver nl tests
flake8_junit flake8.txt flake8.xml
rm flake8.txt

cython-lint:
- cython-lint --max-line-length=160 drivers examples packageTools base metisCy fem multilevelSolver nl tests > cython-lint.txt 2>&1
flake8_junit cython-lint.txt cython-lint.xml
rm cython-lint.txt
sed 's/name="flake8"/name="cython-lint"/g' cython-lint.xml > cython-lint2.xml
mv cython-lint2.xml cython-lint.xml
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ For example, on Ubuntu podman can be installed with
Instructions for other platforms can be found here: https://podman.io/docs/installation

Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/compose.yaml and save it to an empty directory.
Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/blob/master/compose.yaml and save it to an empty directory.
In that directory we then run

.. code-block:: shell
Expand All @@ -121,7 +121,7 @@ For development using PyNucleus it can be useful to launch a Jupyter notebook se
podman compose up pynucleus-jupyter
and then open the access the Jupyter notebook interface at https://localhost:8889
and then open the Jupyter notebook interface at https://localhost:8889


Spack install
Expand Down
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:

# Launch with:
# docker compose up
# Then open localhost:8888 in your browser
# Then open localhost:8889 in your browser
pynucleus-jupyter:
image: ghcr.io/sandialabs/pynucleus:latest
build: .
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For example, on Ubuntu podman can be installed with
Instructions for other platforms can be found here: https://podman.io/docs/installation

Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/compose.yaml and save it to an empty directory.
Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/blob/master/compose.yaml and save it to an empty directory.
In that directory we then run

.. code-block:: shell
Expand All @@ -50,7 +50,7 @@ For development using PyNucleus it can be useful to launch a Jupyter notebook se
podman compose up pynucleus-jupyter
and then open the access the Jupyter notebook interface at https://localhost:8889
and then open the Jupyter notebook interface at https://localhost:8889


Spack install
Expand Down

0 comments on commit 07da094

Please sign in to comment.