Skip to content

Commit

Permalink
Use the UM2N Docker image (#59)
Browse files Browse the repository at this point in the history
Closes #57.

Linked PR:
mesh-adaptation/docs#59.

This PR sets up UM2N's CI to use the newly added bespoke Docker image.
It also makes use of the reusable test workflow from the docs repo.
  • Loading branch information
jwallwork23 authored Nov 23, 2024
1 parent 05b98e9 commit f7f7963
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 57 deletions.
76 changes: 22 additions & 54 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,31 @@
name: Install and test UM2N
name: 'Run UM2N Test Suite'

on:
# Run test suite whenever main is updated
push:
branches:
- main

# Run test suite whenever commits are pushed to an open PR
pull_request:

jobs:
test-warpmesh:
name: Test UM2N
runs-on: ubuntu-latest
container:
image: firedrakeproject/firedrake:latest
options: --user root
steps:
- uses: actions/checkout@v3

- name: Cleanup
if: ${{ always() }}
run: |
cd ..
rm -rf build
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Lint check
if: ${{ always() }}
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pip install ruff
ruff check
- name: Install Movement
run: |
. /home/firedrake/firedrake/bin/activate
git clone https://github.com/mesh-adaptation/movement.git
cd movement
python3 -m pip install -e .
# Run test suite every Sunday at 1AM
schedule:
- cron: '0 1 * * 0'

- name: Install PyTorch
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install PyTorch3d
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pip install 'git+https://github.com/facebookresearch/pytorch3d.git'
- name: Install UM2N
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pip install -e .
- name: Run UM2N test suite
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pytest tests/test* -v
jobs:
test_suite:
uses: mesh-adaptation/mesh-adaptation-docs/.github/workflows/reusable_test_suite.yml@main
with:
install-command: 'python -m pip uninstall -y UM2N && python -m pip install -e .'
test-command: |
export GITHUB_ACTIONS_TEST_RUN=1
python $(which firedrake-clean)
python -m coverage erase
python -m coverage run -a --source=UM2N -m pytest -v --durations=20 test
python -m coverage report
changed-files-patterns: |
**/*.py
**/*.msh
**/*.geo
docker-image: firedrake-um2n
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
all: install

.PHONY: install test

install:
@echo "Installing UM2N..."
@python3 -m pip install -e .
@echo "Done."
@echo "Setting up pre-commit..."
@pre-commit install
@echo "Done."

lint:
@echo "Checking lint..."
@ruff check
@echo "PASS"

test: lint
@echo "Running all tests..."
@python3 -m pytest -v --durations=20 test
@echo "Done."

coverage:
@echo "Generating coverage report..."
@python3 -m coverage erase
@python3 -m coverage run --source=UM2N -m pytest -v test
@python3 -m coverage html
@echo "Done."

tree:
@tree -d .
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ The documentation is generated by Sphinx. To build the documentation, under the
├── docs (Documentation)
│ ├── conf.py
│ └── index.rst
├── play
│ ├── play_conv_feat.py
│ └── play_dataset.py
├── script (Utility scripts)
│ ├── make_dataset.sh (Script for making datasets of different sizes)
│ ├── build_helmholtz_dataset.py (Build helmholtz dataset)
Expand All @@ -159,9 +162,7 @@ The documentation is generated by Sphinx. To build the documentation, under the
│ ├── plot.py
│ ├── train_model.py
│ └── ...
├── tests
│ ├── play_conv_feat.py
│ ├── play_dataset.py
├── test
│ ├── test_import.py
│ └── ...
├── install.sh (Installation script for UM2N and its dependencies)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f7f7963

Please sign in to comment.