Skip to content
Draft
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
273 changes: 268 additions & 5 deletions .github/workflows/hello.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,276 @@
name: CI
name: Build

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "9 16 * * 1"

jobs:
hello:
runs-on: ubuntu-latest
build-test-repo:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
cfg:
- lane: linux-gnu
runs-on: ubuntu-latest
python-version: "3.12"
cmargs: ""

- lane: linux-clang
runs-on: ubuntu-latest
python-version: "3.12"
cmargs: >
-D CMAKE_C_COMPILER=clang

- lane: linux-icpx
runs-on: ubuntu-latest
python-version: "3.12"
cmargs: >
-D CMAKE_C_COMPILER=icpx

- lane: linux-arm64-gnu
runs-on: ubuntu-24.04-arm
python-version: "3.12"
cmargs: ""

- lane: macos-silicon-clang
runs-on: macos-latest
python-version: "3.12"
cmargs: ""

- lane: windows-clang
runs-on: windows-latest
python-version: "3.12"
cmargs: >
-D CMAKE_C_COMPILER=clang-cl

name: "Repo - Python ${{ matrix.cfg.python-version }} - ${{ matrix.cfg.lane }}"
runs-on: ${{ matrix.cfg.runs-on }}
defaults:
run:
shell: bash -l {0}

steps:
- name: Say hello
run: echo "Hello, GitHub Actions!"
- name: Checkout gau2grid
uses: actions/checkout@v5

- name: Prepare compiler environment, vcvarsall (W)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Write a Conda Env File
run: |
cat > export.yaml <<EOF
name: test
channels:
- conda-forge
dependencies:
- cmake
- ninja
- c-compiler
- python
- numpy
- pytest
EOF
if [[ "${{ matrix.cfg.lane }}" == "linux-clang" ]]; then
echo " - clang_linux-64" >> export.yaml
fi
if [[ "${{ matrix.cfg.lane }}" == "linux-icpx" ]]; then
echo " - dpcpp_linux-64" >> export.yaml
fi
cat export.yaml

- name: Create Conda Environment
uses: conda-incubator/setup-miniconda@v4
with:
python-version: ${{ matrix.cfg.python-version }}
activate-environment: test
channels: conda-forge
environment-file: export.yaml
show-channel-urls: true
auto-activate: false
add-pip-as-python-dependency: true
conda-remove-defaults: true

- name: Environment Information
run: |
conda info
conda list

- name: Build & Install gau2grid
run: |
cmake \
-S . \
-B build \
-G "Ninja" \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX="${{ github.workspace }}/installed" \
-D CMAKE_PREFIX_PATH="${CONDA_PREFIX};${CONDA_PREFIX}/Library" \
${{ matrix.cfg.cmargs }}
cmake --build build --target install

- name: Testing find_package Consumption
run: |
mkdir consume_fp
cat > consume_fp/CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 3.16)
project(gau2grid_consume LANGUAGES C)
find_package(gau2grid CONFIG REQUIRED)
add_executable(gau2grid_consume main.c)
target_link_libraries(gau2grid_consume PRIVATE gau2grid::gg)
EOF
cat > consume_fp/main.c <<EOF
#include <gau2grid/gau2grid.h>
int main(void) {
return (gg_max_L() < 0);
}
EOF
cmake \
-S consume_fp \
-B consume_fp/build \
-G "Ninja" \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_PREFIX_PATH="${{ github.workspace }}/installed" \
${{ matrix.cfg.cmargs }}
cmake --build consume_fp/build --target gau2grid_consume
if [[ "${{ runner.os }}" == "Linux" ]]; then
export LD_LIBRARY_PATH="${{ github.workspace }}/installed/lib:${LD_LIBRARY_PATH}"
./consume_fp/build/gau2grid_consume
elif [[ "${{ runner.os }}" == "macOS" ]]; then
export DYLD_LIBRARY_PATH="${{ github.workspace }}/installed/lib:${DYLD_LIBRARY_PATH}"
./consume_fp/build/gau2grid_consume
else
export PATH="${{ github.workspace }}/installed/bin:${PATH}"
./consume_fp/build/gau2grid_consume.exe
fi

build-test-python:
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
cfg:
- lane: linux-gnu
runs-on: ubuntu-latest
- lane: linux-arm64-gnu
runs-on: ubuntu-24.04-arm
- lane: macos-silicon-clang
runs-on: macos-latest
python-version: ["3.11", "3.12", "3.13"]

name: "Python - ${{ matrix.python-version }} - ${{ matrix.cfg.lane }}"
runs-on: ${{ matrix.cfg.runs-on }}
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout gau2grid
uses: actions/checkout@v5

- name: Write a Conda Env File
run: |
cat > export-py.yaml <<EOF
name: test-py
channels:
- conda-forge
dependencies:
- cmake
- ninja
- c-compiler
- python
- numpy
- pytest
- pip
- setuptools
EOF
cat export-py.yaml

- name: Create Conda Environment
uses: conda-incubator/setup-miniconda@v4
with:
python-version: ${{ matrix.python-version }}
activate-environment: test-py
channels: conda-forge
environment-file: export-py.yaml
show-channel-urls: true
auto-activate: false
add-pip-as-python-dependency: true
conda-remove-defaults: true

- name: Environment Information
run: |
conda info
conda list

- name: Build and install Python package
run: |
python setup.py install

- name: Run Python tests
run: |
export GAU2GRID_FORCE_C_TEST=1
python -m pytest -rws -v --durations=10 --pyargs gau2grid

build-docs:
timeout-minutes: 20
needs: [build-test-repo]
strategy:
fail-fast: false
matrix:
cfg:
- label: Sphinx
python-version: "3.12"
runs-on: ubuntu-latest

name: "Docs - Python ${{ matrix.cfg.python-version }}"
runs-on: ${{ matrix.cfg.runs-on }}
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v5

- name: Write a Conda Env File
run: |
cat > export-docs.yaml <<EOF
name: test-docs
channels:
- conda-forge
dependencies:
- python
- numpy
- sphinx
- sphinx_rtd_theme
- pip
EOF
cat export-docs.yaml

- name: Create Environment
uses: conda-incubator/setup-miniconda@v4
with:
activate-environment: test-docs
environment-file: export-docs.yaml
python-version: ${{ matrix.cfg.python-version }}
auto-activate: false
show-channel-urls: true
add-pip-as-python-dependency: true
channels: conda-forge

- name: Environment Information
run: |
conda info
conda list --show-channel-urls

- name: Build Documentation
run: |
make -C docs html SPHINXOPTS="-W --keep-going"
Loading