Skip to content

Reorganise testing and CI #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
166 changes: 166 additions & 0 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Install and test asQ

on:
# Run on pushes to master
push:
branches:
- master
# And all pull requests
pull_request:
schedule:
# Scheduled run over at 0217 UTC Sunday to detect any upstream breaks.
# * is a special character in YAML so you have to quote this string
- cron: '17 2 * * 0'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
# Cancels jobs running if new commits are pushed
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: "Build and test asQ"
# Use Firedrake's Linux runners
runs-on: [self-hosted, Linux]
# Use the firedrake container without asQ installed - we want to run the repo version.
container:
image: firedrakeproject/firedrake-vanilla-default:latest
env:
# Sometimes we want to determine if tests are running on CI
ASQ_CI_TESTS: 1
# Tell pyop2 to complain if SPMD assumptions are broken
PYOP2_SPMD_STRICT: 1
# Make sure tests with >8 processes are not silently skipped
PYTEST_MPI_MAX_NPROCS: 8
# Common arguments for pytest. TODO: Is pytest coverage possible firedrake-run-split-tests?
PYTEST_ARGS: --durations=50 --timeout=500 --timeout-method=thread -o faulthandler_timeout=600 --verbose asQ-repo/tests/
# venv activation script
ACTIVATE: venv-asQ/bin/activate
steps:
- name: Fix HOME
# For unknown reasons GitHub actions overwrite HOME to /github/home
# which will break everything unless fixed
# (https://github.com/actions/runner/issues/863)
run: echo "HOME=/home/firedrake" >> "$GITHUB_ENV"

- name: Pre-cleanup
# TODO: Why do we need to do this?
run: |
: # Wipe everything away in the current directory
find . -delete
firedrake-clean

- uses: actions/checkout@v4
with:
# Download asQ into a subdirectory not called 'asQ' to make sure
# that the package installs correctly. Otherwise 'import asQ' may
# work even if the installation failed because it is a subdirectory.
path: asQ-repo

- name: Create virtual environment
# pass '--system-site-packages' so Firedrake can be found
run: python3 -m venv --system-site-packages venv-asQ

- name: Install asQ
id: install
run: |
. $ACTIVATE
python --version
pip --version
pip install ./asQ-repo
pip list
python -m pytest --version
# TODO: firedrake-status doesn't work without $VIRTUAL_ENV/src. Is it obsolete now?
# firedrake-status

- name: Lint
run: |
. $ACTIVATE
python -m pip install flake8
cd ./asQ-repo
flake8 .

- name: Run tests (nprocs = 1)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
: # Use pytest-xdist here so we can have a single collated output (not possible
: # for parallel tests)
firedrake-run-split-tests 1 1 -n 12 --dist worksteal "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 2)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 2 6 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 3)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 3 4 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 4)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 4 3 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 5)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 5 2 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 6)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 6 2 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 7)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 7 1 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Run tests (nprocs = 8)
# Run even if earlier tests failed
if: success() || steps.install.conclusion == 'success'
run: |
. $ACTIVATE
firedrake-run-split-tests 8 1 "$PYTEST_ARGS"
timeout-minutes: 20

- name: Upload pytest log files
uses: actions/upload-artifact@v4
if: success() || steps.install.conclusion == 'success'
with:
name: pytest-logs
path: pytest_*.log
retention-days: 5

- name: Post-cleanup
if: always()
run: |
find . -delete
firedrake-clean
65 changes: 0 additions & 65 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion asQ/allatonce/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, ensemble, time_partition, function_space):
self.function_space = reduce(mul, (self.field_function_space
for _ in range(self.nlocal_timesteps)))

self.ncomponents = len(self.field_function_space.subfunctions)
self.ncomponents = len(self.field_function_space.subspaces)

# this will be renamed either self.function or self.cofunction
self._fbuf = fd.Function(self.function_space)
Expand Down
7 changes: 6 additions & 1 deletion asQ/allatonce/solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from firedrake.petsc import PETSc, OptionsManager, flatten_parameters
from firedrake.petsc import PETSc
# TODO: remove this check once petsctools is included in firedrake release
try: # Firedrake master
from petsctools import OptionsManager, flatten_parameters
except ImportError: # Firedrake release
from firedrake.petsc import OptionsManager, flatten_parameters

from asQ.profiling import profiler
from asQ.allatonce import (AllAtOnceCofunction, AllAtOnceFunction,
Expand Down
2 changes: 1 addition & 1 deletion asQ/complex_proxy/vector_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def split(u, i):

us = fd.split(u)

ncomponents = len(u.function_space().subfunctions)
ncomponents = len(u.function_space().subspaces)

if ncomponents == 1:
return tuple((us[i],))
Expand Down
2 changes: 1 addition & 1 deletion asQ/preconditioners/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def initialize(self, pc, final_initialize=True):
raise ValueError("Expecting PC type python")

# grab aao objects off petsc mat python context
prefix = pc.getOptionsPrefix()
prefix = pc.getOptionsPrefix() or ""
self.full_prefix = prefix + self.prefix
if hasattr(self, "deprecated_prefix"):
self.deprecated_prefix = prefix + self.deprecated_prefix
Expand Down
Loading
Loading