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

Testing in pull requests #12

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Test QDyn
# Suggestion from ChatGPT

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gfortran make wget tar

# Download, build, and install FFTW library
- name: Build and install FFTW
run: |
# Specify the FFTW version
FFTW_VERSION=3.3.10
wget http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz
tar -xzf fftw-${FFTW_VERSION}.tar.gz
cd fftw-${FFTW_VERSION}
./configure --enable-shared --prefix=/usr/local
make -j$(nproc)
sudo make install
cd ..

# Build the project using make
- name: Build the project
run: make

# Run tests using make
- name: Run tests
run: make tests
65 changes: 65 additions & 0 deletions .github/workflows/test_v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:

permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
intel_build:
name: Intel OneAPI build
runs-on: ubuntu-20.04
env:
FC: mpiifort
APT_PACKAGES: >-
intel-oneapi-compiler-fortran
intel-oneapi-mpi
intel-oneapi-mpi-devel

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

# - name: Install fftw
# run: |
# echo "Entering FFTW folder"
# cd fftw
# echo "Unpacking FFTW"
# tar -xf fftw.tar.gz
# echo "Compiling FFTW"
# cd fftw
# bash compile.sh

- name: Add Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update

- name: Install Intel oneAPI compiler
run: |
sudo apt-get install ${{ env.APT_PACKAGES }}
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV

- name: Install fftw & build QDyn
run: |
echo "Entering FFTW folder"
cd fftw
echo "Unpacking FFTW"
tar -xf fftw.tar.gz
echo "Compiling FFTW"
cd fftw
bash compile.sh
echo "Compile QDyn"
cd ../../src
make clean && make
Binary file modified fftw/fftw.tar.gz
Binary file not shown.
12 changes: 8 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
# Compiler
FC = gfortran
FFLAGS =
#FFTW library needed
# LIBS = -L/home/janos/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm -llapack
# LIBS = -L/Users/janosj/Documents/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm
# FFTW library needed
LIBS = -L/Users/janosj/Documents/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm -llapack
LDLIBS = -lfftw3 # This is necessary only on clusters, not on MacOS

# for Github tests, I use different fftw library path
GitHub_LIBS = -L/usr/local/lib -lfftw3 -lm -llapack

# Name of program
OUT = qdyn

#======================================================================

# List of all files (NAME ALL F90)
OBJS = vars.o fparser.o fftw.o utils.o init.o propag.o qdyn.o
OBJS = vars.o fparser.o fftw.o utils.o init.o exactfactor.o propag.o qdyn.o

myprogram: $(OBJS)
$(FC) -o $(OUT) ${LIBS} ${FFLAGS} $(OBJS) ${LDLIBS}

github-build: $(OBJS)
$(FC) -o $(OUT) ${GitHub_LIBS} ${FFLAGS} $(OBJS) ${LDLIBS}

clean:
/bin/rm -f *.o *.mod $(OUT)

Expand Down
Loading