Skip to content

Commit cdee592

Browse files
committed
Add cython-lint, fix bugs
1 parent ee2a6f3 commit cdee592

File tree

6 files changed

+75
-37
lines changed

6 files changed

+75
-37
lines changed

.github/workflows/build.yml

+55-27
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
branches: [ "master" ]
88
workflow_dispatch:
99

10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1015
jobs:
1116

1217
linux:
@@ -33,6 +38,8 @@ jobs:
3338
PYNUCLEUS_BUILD_PARALLELISM: 2
3439
OMPI_CC: ${{ matrix.c-compiler }}
3540
OMPI_CXX: ${{ matrix.cxx-compiler }}
41+
BUILD_PRETTY_IDENTIFIER: "Linux ${{ matrix.c-compiler }} Python ${{ matrix.py-version }}"
42+
BUILD_IDENTIFIER: "Linux-${{ matrix.c-compiler }}-${{ matrix.py-version }}"
3643

3744
steps:
3845
- name: Check out repo
@@ -45,7 +52,7 @@ jobs:
4552
uses: actions/cache/restore@v3
4653
with:
4754
path: /home/runner/.cache/ccache
48-
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}
55+
key: ccache-${{ env.BUILD_IDENTIFIER }}
4956

5057
- uses: actions/setup-python@v4
5158
if: always()
@@ -77,52 +84,53 @@ jobs:
7784
GH_TOKEN: ${{ github.token }}
7885
run: |
7986
gh extension install actions/gh-actions-cache
80-
gh actions-cache delete ccache-${{ runner.os }}-${{ matrix.c-compiler}}-${{ matrix.py-version }} --confirm
87+
gh actions-cache delete ccache-${{ env.BUILD_IDENTIFIER }} --confirm
8188
continue-on-error: true
8289

8390
- name: Push ccache cache
8491
if: always()
8592
uses: actions/cache/save@v3
8693
with:
8794
path: /home/runner/.cache/ccache
88-
key: ccache-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}
95+
key: ccache-${{ env.BUILD_IDENTIFIER }}
8996

9097
- name: Ccache report
9198
if: always()
9299
run: ccache -s
93100

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

98105
- name: Run flake8
99106
if: always()
100107
run: |
101108
make flake8
102-
mv flake8.xml flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
109+
mv flake8.xml flake8-${{ env.BUILD_IDENTIFIER }}.xml
103110
104-
- name: Archive test results
105-
uses: actions/upload-artifact@v3
111+
- name: Run cython-lint
106112
if: always()
107-
with:
108-
name: Test results
109-
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
113+
run: |
114+
make cython-lint
115+
mv cython-lint.xml cython-lint-${{ env.BUILD_IDENTIFIER }}.xml
110116
111-
- name: Report test results
112-
uses: dorny/test-reporter@v1
117+
- name: Archive results
118+
uses: actions/upload-artifact@v3
113119
if: always()
114120
with:
115-
name: Test report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
116-
path: test-results-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
117-
reporter: java-junit
118-
fail-on-error: true
121+
name: Results (${{ env.BUILD_PRETTY_IDENTIFIER }})
122+
path: |
123+
test-results-${{ env.BUILD_IDENTIFIER }}.xml
124+
flake8-${{ env.BUILD_IDENTIFIER }}.xml
125+
cython-lint-${{ env.BUILD_IDENTIFIER }}.xml
119126
120-
- name: Report flake8 results
127+
- name: Report results
121128
uses: dorny/test-reporter@v1
122129
if: always()
123130
with:
124-
name: Flake8 report (${{ runner.os }}, ${{ matrix.c-compiler }}, Python ${{ matrix.py-version }})
125-
path: flake8-${{ runner.os }}-${{ matrix.c-compiler }}-${{ matrix.py-version }}.xml
131+
name: Report (${{ env.BUILD_PRETTY_IDENTIFIER }})
132+
path: |
133+
*-${{ env.BUILD_IDENTIFIER }}.xml
126134
reporter: java-junit
127135
fail-on-error: false
128136

@@ -157,7 +165,7 @@ jobs:
157165
key: ccache-${{ runner.os }}-${{ matrix.py-version }}
158166

159167
- name: Setup GNU Fortran
160-
uses: modflowpy/install-gfortran-action@v1
168+
uses: fortran-lang/setup-fortran@v1
161169

162170
- uses: actions/setup-python@v4
163171
with:
@@ -173,6 +181,10 @@ jobs:
173181
if: always()
174182
run: ccache --show-config
175183

184+
- name: Augment path
185+
run: |
186+
echo "$HOME/.local/bin" >> $GITHUB_PATH
187+
176188
- name: Install Python dependencies
177189
run: make prereq && make prereq-extra
178190

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

207-
- name: Archive test results
219+
- name: Run flake8
220+
if: always()
221+
run: |
222+
make flake8
223+
mv flake8.xml flake8-${{ runner.os }}-${{ matrix.py-version }}.xml
224+
225+
- name: Run cython-lint
226+
if: always()
227+
run: |
228+
make cython-lint
229+
mv cython-lint.xml cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml
230+
231+
- name: Archive results
208232
uses: actions/upload-artifact@v3
209233
if: always()
210234
with:
211-
name: Test results
212-
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
235+
name: Results ${{ github.job }}
236+
path: |
237+
test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
238+
flake8-${{ runner.os }}-${{ matrix.py-version }}.xml
239+
cython-lint-${{ runner.os }}-${{ matrix.py-version }}.xml
213240
214-
- name: Report test results
241+
- name: Report results
215242
uses: dorny/test-reporter@v1
216243
if: always()
217244
with:
218-
name: Test report (${{ runner.os }}, Python ${{ matrix.py-version }})
219-
path: test-results-${{ runner.os }}-${{ matrix.py-version }}.xml
245+
name: Report (${{ github.job }})
246+
path: |
247+
*-${{ runner.os }}-${{ matrix.py-version }}.xml
220248
reporter: java-junit
221-
fail-on-error: true
249+
fail-on-error: false

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ ENV VIRTUAL_ENV=/pynucleus/venv
3333
RUN python3 -m venv $VIRTUAL_ENV
3434
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
3535
WORKDIR /pynucleus
36-
RUN make prereq && \
37-
make prereq-extra && \
36+
RUN make prereq PIP_FLAGS=--no-cache-dir && \
37+
make prereq-extra PIP_FLAGS=--no-cache-dir && \
3838
make install && \
3939
python -m pip install --no-cache-dir ipykernel && \
4040
rm -rf build packageTools/build base/build metisCy/build fem/build multilevelSolver/build nl/build
@@ -45,6 +45,8 @@ RUN echo "alias ls='ls --color=auto -FN'" >> /root/.bashrc \
4545
# allow running MPI as root in the container
4646
# bind MPI ranks to hwthreads
4747
ENV OMPI_MCA_hwloc_base_binding_policy=hwthread \
48-
MPIEXEC_FLAGS=--allow-run-as-root
48+
MPIEXEC_FLAGS=--allow-run-as-root \
49+
OMPI_ALLOW_RUN_AS_ROOT=1 \
50+
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
4951

5052
RUN python -m ipykernel install --name=PyNucleus

Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,16 @@ prereq:
169169
$(PYTHON) -m pip install $(PIP_FLAGS) $(PIP_INSTALL_FLAGS) scikit-sparse
170170

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

174174
flake8:
175-
$(PYTHON) -m flake8 --output-file=flake8.txt --exit-zero drivers packageTools base metisCy fem multilevelSolver nl tests
175+
$(PYTHON) -m flake8 --output-file=flake8.txt --exit-zero drivers examples packageTools base metisCy fem multilevelSolver nl tests
176176
flake8_junit flake8.txt flake8.xml
177+
rm flake8.txt
178+
179+
cython-lint:
180+
- cython-lint --max-line-length=160 drivers examples packageTools base metisCy fem multilevelSolver nl tests > cython-lint.txt 2>&1
181+
flake8_junit cython-lint.txt cython-lint.xml
182+
rm cython-lint.txt
183+
sed 's/name="flake8"/name="cython-lint"/g' cython-lint.xml > cython-lint2.xml
184+
mv cython-lint2.xml cython-lint.xml

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ For example, on Ubuntu podman can be installed with
9999
100100
Instructions for other platforms can be found here: https://podman.io/docs/installation
101101

102-
Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/compose.yaml and save it to an empty directory.
102+
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.
103103
In that directory we then run
104104

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

126126

127127
Spack install

compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525

2626
# Launch with:
2727
# docker compose up
28-
# Then open localhost:8888 in your browser
28+
# Then open localhost:8889 in your browser
2929
pynucleus-jupyter:
3030
image: ghcr.io/sandialabs/pynucleus:latest
3131
build: .

docs/installation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ For example, on Ubuntu podman can be installed with
2828
2929
Instructions for other platforms can be found here: https://podman.io/docs/installation
3030

31-
Once podman is installed, we can download a copy of https://github.com/sandialabs/PyNucleus/compose.yaml and save it to an empty directory.
31+
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.
3232
In that directory we then run
3333

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

5555

5656
Spack install

0 commit comments

Comments
 (0)