Skip to content
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

Fedora packaging #444

Open
wants to merge 11 commits into
base: develop
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
1 change: 1 addition & 0 deletions .distro/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
7 changes: 7 additions & 0 deletions .distro/plans/full.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary:
Test the bundled ctests and pytest
discover+:
how: fmf
path: test-suite
execute:
how: tmt
6 changes: 6 additions & 0 deletions .distro/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
adjust+:
# Cannot use initiator: fedora-ci reliably yet
when: initiator is not defined or initiator != packit
discover:
how: fmf
dist-git-source: true
5 changes: 5 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
10 changes: 10 additions & 0 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prepare:
- how: shell
script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
discover:
how: fmf
filter: "tag: rpmlint"
url: https://github.com/packit/tmt-plans
ref: main
execute:
how: tmt
Empty file added .distro/wannier90.rpmlintrc
Empty file.
160 changes: 160 additions & 0 deletions .distro/wannier90.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
Name: wannier90
Summary: Maximally-Localised Generalised Wannier Functions Code
Version: 0.0.0
Release: %autorelease
License: GPLv2
URL: https://www.wannier.org/

Source: https://github.com/wannier-developers/wannier90/archive/refs/tags/v%{version}.tar.gz

BuildRequires: ninja-build
BuildRequires: cmake
BuildRequires: gcc-fortran
BuildRequires: flexiblas-devel
# Required for testing
BuildRequires: gcc-c++
BuildRequires: python3

%global _description %{expand:
Maximally-Localised Generalised Wannier Functions Code.}

%description
%{_description}

%package devel
Summary: Development files for wannier90
Requires: wannier90%{?_isa} = %{version}-%{release}

%description devel
This package contains the development files for the wannier90 library.

%package openmpi
Summary: Maximally-Localised Generalised Wannier Functions Code - OpenMPI version
BuildRequires: openmpi-devel

%description openmpi
%{_description}

This package contains the OpenMPI parallel version.

%package openmpi-devel
Summary: Development files for wannier90 - OpenMPI version
Requires: wannier90-openmpi%{?_isa} = %{version}-%{release}

%description openmpi-devel
This package contains the development files for the wannier90 (OpenMPI) library.

%package mpich
Summary: Maximally-Localised Generalised Wannier Functions Code - MPICH version
BuildRequires: mpich-devel

%description mpich
%{_description}

This package contains the MPICH parallel version.

%package mpich-devel
Summary: Development files for wannier90 - MPICH version
Requires: wannier90-mpich%{?_isa} = %{version}-%{release}

%description mpich-devel
This package contains the development files for the wannier90 (MPICH) library.


%prep
%autosetup -n wannier90-%{version}

# $MPI_SUFFIX will be evaluated in the loops below, set by mpi modules
%global _vpath_builddir %{_vendor}-%{_target_os}-build${MPI_SUFFIX:-_serial}
# We are running the module load/unload manually until there is a macro-like way to expand this
. /etc/profile.d/modules.sh


%build
cmake_common_args=(
"-G Ninja"
"-DWANNIER90_SHARED_LIBS=ON"
"-DWANNIER90_TEST=ON"
)
for mpi in '' mpich openmpi ; do
if [ -n "$mpi" ]; then
module load mpi/${mpi}-%{_arch}
cmake_mpi_args=(
"-DCMAKE_INSTALL_PREFIX=${MPI_HOME}"
"-DWANNIER90_MPI=ON"
"-DCMAKE_INSTALL_MODULEDIR=${MPI_FORTRAN_MOD_DIR}"
"-DCMAKE_INSTALL_LIBDIR=lib"
)
else
cmake_mpi_args=(
"-DWANNIER90_MPI=OFF"
"-DCMAKE_INSTALL_MODULEDIR=%{_fmoddir}"
)
fi

%cmake \
${cmake_common_args[@]} \
${cmake_mpi_args[@]}
%cmake_build

[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
done


%install
for mpi in '' mpich openmpi ; do
[ -n "$mpi" ] && module load mpi/${mpi}-%{_arch}
%cmake_install
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
done


%check
for mpi in '' mpich %{?with_openmpi:openmpi} ; do
[ -n "$mpi" ] && module load mpi/${mpi}-%{_arch}
# TODO: re-enable tests
# %%ctest
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
done


%files
%doc README.rst
%license LICENSE
%{_libdir}/libwannier90.so.*
%{_bindir}/wannier90.x
%{_bindir}/postw90.x

%files devel
%{_includedir}/wannier90.hh
%{_libdir}/libwannier90.so
%{_fmoddir}/Wannier90/
%{_libdir}/cmake/Wannier90
%{_libdir}/pkgconfig/wannier90.pc

%files openmpi
%{_libdir}/openmpi/bin/wannier90.x
%{_libdir}/openmpi/bin/postw90.x
%{_libdir}/openmpi/lib/libwannier90.so.*

%files openmpi-devel
%{_libdir}/openmpi/include/wannier90.hh
%{_libdir}/openmpi/lib/libwannier90.so
%{_fmoddir}/openmpi/Wannier90/
%{_libdir}/openmpi/lib/cmake/Wannier90
%{_libdir}/openmpi/lib/pkgconfig/wannier90.pc

%files mpich
%{_libdir}/mpich/bin/wannier90.x
%{_libdir}/mpich/bin/postw90.x
%{_libdir}/mpich/lib/libwannier90.so.*

%files mpich-devel
%{_libdir}/mpich/include/wannier90.hh
%{_libdir}/mpich/lib/libwannier90.so
%{_fmoddir}/mpich/Wannier90/
%{_libdir}/mpich/lib/cmake/Wannier90
%{_libdir}/mpich/lib/pkgconfig/wannier90.pc

%changelog
%autochangelog
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI
run-name: >
CI (${{ github.event_name }})
${{ github.event_name == 'pull_request' && format('PR#{0}', github.event.number) || '' }}

on:
workflow_dispatch:
pull_request:
branches: [ develop ]
push:
branches: [ develop ]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
name: pre-commit
uses: ./.github/workflows/step_pre-commit.yaml

tests:
name: test
needs: [ pre-commit ]
uses: ./.github/workflows/step_test.yaml
with:
mask-experimental: ${{ github.event_name == 'push' }}

tests-makefile:
name: test Makefile
needs: [ pre-commit ]
uses: ./.github/workflows/step_test-makefile.yaml

docs:
name: 📘 docs
needs: [ pre-commit ]
uses: ./.github/workflows/step_docs.yaml

pass:
name: ✅ Pass
needs: [ pre-commit, tests, tests-makefile, docs ]
runs-on: ubuntu-latest
steps:
- name: Check all CI jobs
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
if: always()
28 changes: 28 additions & 0 deletions .github/workflows/step_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 📘 test-docs

on:
workflow_call:

permissions:
contents: read

jobs:
docs:
name: Validate mkdocs links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# use the latest stable version
python-version: "3.x"
cache: "pip"
# `pybtex` uses `pkg_resources` which is deprecated. Use workaround until upstream `mkdocs_bibtext`decides on a solution
# https://github.com/shyamd/mkdocs-bibtex/issues/228
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
- run: pip install -r docs/requirements.txt setuptools
- run: mkdocs build --strict
working-directory: ./docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_MKDOCS_GIT_COMMITTERS: False
20 changes: 20 additions & 0 deletions .github/workflows/step_pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pre-commit

on:
workflow_call:

permissions:
contents: read

jobs:
pre-commit:
name: Check pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/[email protected]
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
name: CI
name: test Makefile

on:
pull_request:
push:
branches:
- develop
workflow_call:

permissions:
contents: read
jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

build:
runs-on: ubuntu-20.04
strategy:
Expand Down Expand Up @@ -66,23 +58,3 @@ jobs:
path: |
test-suite/tests/test*/test.err*
test-suite/tests/test*/test.out*

docs:
name: Validate mkdocs links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# use the latest stable version
python-version: "3.x"
cache: "pip"
# `pybtex` uses `pkg_resources` which is deprecated. Use workaround until upstream `mkdocs_bibtext`decides on a solution
# https://github.com/shyamd/mkdocs-bibtex/issues/228
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
- run: pip install -r docs/requirements.txt setuptools
- run: mkdocs build --strict
working-directory: ./docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_MKDOCS_GIT_COMMITTERS: False
Loading