diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml index 54dec23..a8e074e 100644 --- a/.github/workflows/hello.yml +++ b/.github/workflows/hello.yml @@ -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 <> 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 < consume_fp/main.c < + 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 < export-docs.yaml <