From 7720ddbd3545498a4a5a34fc54b705b47c3d8b74 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 31 Aug 2023 11:34:57 -0700 Subject: [PATCH] Create Stub Files: Scripts & CI --- .github/update_sub.sh | 17 ++++++++++++ .github/workflows/ci.yml | 33 +++++++++++++++++++++++ .github/workflows/hip.yml | 2 +- .github/workflows/intel.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/stubs.yml | 50 +++++++++++++++++++++++++++++++++++ .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- 8 files changed, 105 insertions(+), 5 deletions(-) create mode 100755 .github/update_sub.sh create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/stubs.yml diff --git a/.github/update_sub.sh b/.github/update_sub.sh new file mode 100755 index 00000000..3c296e25 --- /dev/null +++ b/.github/update_sub.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright 2021-2023 The AMReX Community +# +# This script updates the .pyi stub files for documentation and interactive use. +# To run this script, pyAMReX needs to be installed (all dimensions) and importable. +# +# Authors: Axel Huebl +# License: BSD-3-Clause-LBNL +# + +# we are in the source directory, .github/ +this_dir=$(cd $(dirname $0) && pwd) + +pybind11-stubgen --ignore-all-errors -o ${this_dir}/../src/amrex/ amrex.space1d +pybind11-stubgen --ignore-all-errors -o ${this_dir}/../src/amrex/ amrex.space2d +pybind11-stubgen --ignore-all-errors -o ${this_dir}/../src/amrex/ amrex.space3d diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..233e422f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: 👑 CI + +# This workflow updates the .pyi stub files for documentation and interactive use. + +on: [push, pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-ci + cancel-in-progress: true + +jobs: + stubs: + uses: ./.github/workflows/stubs.yml + ubuntu: + name: 🐧 Ubuntu + needs: stubs + uses: ./.github/workflows/ubuntu.yml + intel: + name: 🐧 Intel + needs: stubs + uses: ./.github/workflows/intel.yml + hip: + name: 🐧 HIP + needs: stubs + uses: ./.github/workflows/hip.yml + macos: + name: 🍏 macOS + needs: stubs + uses: ./.github/workflows/macos.yml + windows: + name: 🪟 Windows + needs: stubs + uses: ./.github/workflows/windows.yml diff --git a/.github/workflows/hip.yml b/.github/workflows/hip.yml index 90907917..260a7691 100644 --- a/.github/workflows/hip.yml +++ b/.github/workflows/hip.yml @@ -1,6 +1,6 @@ name: 🐧 HIP -on: [push, pull_request] +on: [workflow_call] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-hip diff --git a/.github/workflows/intel.yml b/.github/workflows/intel.yml index 49c8afbf..f86ef79f 100644 --- a/.github/workflows/intel.yml +++ b/.github/workflows/intel.yml @@ -1,6 +1,6 @@ name: 🐧 Intel -on: [push, pull_request] +on: [workflow_call] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-intel diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index fbcd76dc..9398f04b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,6 +1,6 @@ name: 🍏 macOS -on: [push, pull_request] +on: [workflow_call] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-macos diff --git a/.github/workflows/stubs.yml b/.github/workflows/stubs.yml new file mode 100644 index 00000000..b34d2c08 --- /dev/null +++ b/.github/workflows/stubs.yml @@ -0,0 +1,50 @@ +name: 🔄 Update Stub Files + +# This workflow updates the .pyi stub files for documentation and interactive use. + +on: [workflow_call] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-stubs + cancel-in-progress: true + +jobs: + # Build and install libamrex as AMReX CMake project + stubs: + name: Stubs + runs-on: ubuntu-22.04 + env: + CC: gcc + CXX: g++ + CXXFLAGS: "-O1" + if: github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: '3.9' + - name: Dependencies + run: .github/workflows/dependencies/gcc10.sh + - name: Build & Install + run: | + python3 -m pip install -U pip setuptools wheel pytest pybind11-stubgen + cmake -S . -B build -DAMReX_SPACEDIM="1;2;3" + cmake --build build -j 2 --target pip_install + + - name: Update Stubs + run: | + .github/update_stub.sh + + - name: Update Install + run: | + cmake --build build -j 2 --target pip_install + + - name: Unit tests + run: | + mpiexec -np 1 python3 -m pytest tests/ + + - uses: stefanzweifel/git-auto-commit-action@v4 + name: Commit Updated Stub Files + with: + commit_message: Update Stub Files diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 5448724c..f0304093 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,6 +1,6 @@ name: 🐧 Ubuntu -on: [push, pull_request] +on: [workflow_call] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-linux diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 78dc5679..6682c9dd 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,6 +1,6 @@ name: 🪟 Windows -on: [push, pull_request] +on: [workflow_call] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-windows