Skip to content

Commit

Permalink
Patch release preparation (#35)
Browse files Browse the repository at this point in the history
* Bump numpy version, update CI pip cache

* Try intalling newer PETSc/SLEPc versions on CI

* Pin versions in tox.ini

* Fix pins

* Remove redundant CI step

* Try remove arpack for macOS

* Try using 3.9 on macOS

* Temp. disable PETSc/SLEPc on macOS
  • Loading branch information
michalk8 committed Jan 13, 2022
1 parent 3c52a39 commit 494ce4e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 55 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,7 @@ on:
- main

jobs:
init:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.ci-skip-step.outputs.ci-skip }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: ci-skip-step
uses: mstachniuk/ci-skip@master
with:
commit-filter: '[ci skip];[ci-skip];[skip ci];[skip-ci]'
commit-filter-separator: ';'

lint:
needs: init
if: ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -43,7 +27,7 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: precommit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
key: precommit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
precommit-${{ env.pythonLocation }}-
Expand All @@ -58,8 +42,6 @@ jobs:
tox -e lint,check-docs,readme
test:
needs: init
if: ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -73,15 +55,16 @@ jobs:
python: 3.8
use_slepc: true
- os: macos-latest
python: 3.7
use_slepc: true
python: 3.9
# TODO(michalk8): enable this in the future (problem/missing mpif90)
use_slepc: false
- os: macos-latest
python: 3.8
use_slepc: false
env:
# for macOS only, make sure to pin this in tox.ini as well
PC_VERSION: 3.13.5 # PETSc version
SC_VERSION: 3.13.2 # SLEPc version
# make sure to pin this in tox.ini as well
PC_VERSION: 3.15.4 # PETSc version
SC_VERSION: 3.15.2 # SLEPc version

steps:
- uses: actions/checkout@v2
Expand All @@ -93,11 +76,11 @@ jobs:
python-version: ${{ matrix.python }}

- name: Export environment variables
if: matrix.use_slepc == true && runner.os == 'macOS'
if: matrix.use_slepc == true
run: |
echo "PETSC_DIR=$HOME/petsc-$PC_VERSION" >> $GITHUB_ENV
echo "SLEPC_DIR=$HOME/slepc-$SC_VERSION" >> $GITHUB_ENV
echo "PETSC_ARCH=arch-darwin-c-opt" >> $GITHUB_ENV
echo "PETSC_ARCH=arch-$RUNNER_OS-c-opt" >> $GITHUB_ENV
- name: Install PETSc/SLEPc dev dependencies
if: matrix.use_slepc == true
run: |
Expand All @@ -112,8 +95,6 @@ jobs:
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
pip-${{ runner.os }}-${{ env.pythonLocation }}-

- name: Install pip dependencies
run: |
Expand Down
41 changes: 20 additions & 21 deletions .scripts/ci/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -euo pipefail

function install_petsc_macos {
function install_petsc {
curl -O "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-$PC_VERSION.tar.gz"
tar -xzf "petsc-lite-$PC_VERSION.tar.gz"
pushd "petsc-$PC_VERSION"
Expand All @@ -15,42 +15,41 @@ function install_petsc_macos {
popd
}

function install_slepc_macos {
function install_slepc {
curl -O "https://slepc.upv.es/download/distrib/slepc-$SC_VERSION.tar.gz"
tar -xzf "slepc-$SC_VERSION.tar.gz"
pushd "slepc-$SC_VERSION"

./configure --with-arpack-dir=/usr/local/Cellar/arpack
./configure
make all
make check
# make install # only to move into the appropriate location

popd
}


if [[ "$RUNNER_OS" == "Linux" ]]; then
echo "Installing PETSc/SLEPc dependencies for Linux"
sudo apt-get update -y
sudo apt-get install gcc gfortran libopenmpi-dev libblas-dev liblapack-dev petsc-dev slepc-dev -y
sudo apt-get install gcc gfortran libopenmpi-dev libblas-dev liblapack-dev -y
elif [[ "$RUNNER_OS" == "macOS" ]]; then
echo "Installing PETSc/SLEPc with SLEPc dir: '$SLEPC_DIR', PETSc dir: '$PETSC_DIR', PETSc arch: '$PETSC_ARCH'"
pushd "$HOME"

brew install gcc open-mpi openblas lapack arpack
install_petsc_macos
install_slepc_macos

popd

# this seems to be only necessary on the CI
echo "Symlinking numpy"
python -m pip install --upgrade pip
pip install numpy

NUMPY_INCLUDE="$(python -c 'import numpy; print(numpy.get_include())')"
ln -sfv "$NUMPY_INCLUDE/numpy" "$PETSC_DIR/$PETSC_ARCH/include"
else
echo "Invalid OS for PETSc/SLEPc dependencies: $OS"
echo "Invalid OS for PETSc/SLEPc dependencies: '$OS'"
exit 42
fi

echo "Installing PETSc/SLEPc with SLEPc dir: '$SLEPC_DIR', PETSc dir: '$PETSC_DIR', PETSc arch: '$PETSC_ARCH'"

pushd "$HOME"
install_petsc
install_slepc
popd

# this seems to be only necessary on the CI
echo "Installing and symlinking numpy"
python -m pip install --upgrade pip
pip install numpy

NUMPY_INCLUDE="$(python -c 'import numpy; print(numpy.get_include())')"
ln -sfv "$NUMPY_INCLUDE/numpy" "$PETSC_DIR/$PETSC_ARCH/include"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docrep>=0.3.1
# https://numpy.org/neps/nep-0029-deprecation_policy.html#drop-schedule
numpy>=1.15.0
numpy>=1.17.0
# https://github.com/scipy/scipy/releases/tag/v1.5.0
scipy>=1.5.0
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ deps =
pytest-cov
pytest-mock
# we manually install PETSc and SLEPc on the CI from source and the [dev] installation causes problems
macos-slepc: mpi4py>=3.0.3,<3.1
macos-slepc: petsc4py>=3.13,<3.14
macos-slepc: slepc4py>=3.13,<3.14
extras =
linux-slepc: slepc
slepc: mpi4py>=3.0.3
slepc: petsc==3.15.4
slepc: petsc4py==3.15.1
slepc: slepc==3.15.2
slepc: slepc4py==3.15.1
passenv = TOXENV CI CODECOV_* GITHUB_ACTIONS PETSC_* SLEPC_*
usedevelop = true
commands = python -m pytest --cov --cov-append --cov-report=term-missing --cov-config={toxinidir}/tox.ini --ignore docs/ {posargs:-vv}
Expand Down

0 comments on commit 494ce4e

Please sign in to comment.