Skip to content

Commit c2d6d8e

Browse files
authored
Create Stub Files: Scripts & CI (#184)
* Create Stub Files: Scripts & CI * Fixes to Unbound C++ Types * Update Stub Files * CI: Stub-Update Last Since bot pushes to not trigger CI reruns for GH Actions. * Fix using in headers * Update Stub Files
1 parent 304862c commit c2d6d8e

34 files changed

+25207
-189
lines changed

.github/update_stub.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2021-2023 The AMReX Community
4+
#
5+
# This script updates the .pyi stub files for documentation and interactive use.
6+
# To run this script, pyAMReX needs to be installed (all dimensions) and importable.
7+
#
8+
# Authors: Axel Huebl
9+
# License: BSD-3-Clause-LBNL
10+
#
11+
set -eu -o pipefail
12+
13+
# we are in the source directory, .github/
14+
this_dir=$(cd $(dirname $0) && pwd)
15+
16+
pybind11-stubgen --exit-code -o ${this_dir}/../src/amrex/ amrex.space1d
17+
pybind11-stubgen --exit-code -o ${this_dir}/../src/amrex/ amrex.space2d
18+
pybind11-stubgen --exit-code -o ${this_dir}/../src/amrex/ amrex.space3d

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 👑 CI
2+
3+
# This workflow updates the .pyi stub files for documentation and interactive use.
4+
5+
on: [push, pull_request]
6+
7+
concurrency:
8+
group: ${{ github.ref }}-${{ github.head_ref }}-ci
9+
cancel-in-progress: true
10+
11+
jobs:
12+
ubuntu:
13+
name: 🐧 Ubuntu
14+
uses: ./.github/workflows/ubuntu.yml
15+
16+
intel:
17+
name: 🐧 Intel
18+
uses: ./.github/workflows/intel.yml
19+
20+
hip:
21+
name: 🐧 HIP
22+
uses: ./.github/workflows/hip.yml
23+
24+
macos:
25+
name: 🍏 macOS
26+
uses: ./.github/workflows/macos.yml
27+
28+
windows:
29+
name: 🪟 Windows
30+
uses: ./.github/workflows/windows.yml
31+
32+
stubs:
33+
name: 🔄 Update Stub Files
34+
needs: [ubuntu, intel, hip, macos, windows]
35+
uses: ./.github/workflows/stubs.yml

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL"
1+
name: 🔎 CodeQL
22

33
on:
44
push:

.github/workflows/hip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🐧 HIP
22

3-
on: [push, pull_request]
3+
on: [workflow_call]
44

55
concurrency:
66
group: ${{ github.ref }}-${{ github.head_ref }}-hip

.github/workflows/intel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🐧 Intel
22

3-
on: [push, pull_request]
3+
on: [workflow_call]
44

55
concurrency:
66
group: ${{ github.ref }}-${{ github.head_ref }}-intel

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🍏 macOS
22

3-
on: [push, pull_request]
3+
on: [workflow_call]
44

55
concurrency:
66
group: ${{ github.ref }}-${{ github.head_ref }}-macos

.github/workflows/stubs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 🔄 Update Stub Files
2+
3+
# This workflow updates the .pyi stub files for documentation and interactive use.
4+
5+
on: [workflow_call]
6+
7+
concurrency:
8+
group: ${{ github.ref }}-${{ github.head_ref }}-stubs
9+
cancel-in-progress: true
10+
11+
jobs:
12+
# Build and install libamrex as AMReX CMake project
13+
stubs:
14+
name: Stubs
15+
runs-on: ubuntu-22.04
16+
env:
17+
CC: gcc
18+
CXX: g++
19+
CXXFLAGS: "-O1"
20+
OMP_NUM_THREAD: 2
21+
22+
if: github.event.pull_request.draft == false
23+
permissions:
24+
# Give the default GITHUB_TOKEN write permission to commit and push the
25+
# changed files back to the repository.
26+
contents: write
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
32+
ref: ${{ github.head_ref }}
33+
34+
- name: Pull Remote Changes
35+
run: git pull
36+
37+
- uses: actions/setup-python@v4
38+
name: Install Python
39+
with:
40+
python-version: '3.9'
41+
42+
- name: Dependencies
43+
run: .github/workflows/dependencies/dependencies_gcc10.sh
44+
45+
- name: Build & Install
46+
run: |
47+
python3 -m pip install -U pip setuptools wheel
48+
python3 -m pip install -U pip mpi4py pytest pybind11-stubgen pre-commit
49+
cmake -S . -B build -DAMReX_SPACEDIM="1;2;3" -DpyAMReX_IPO=OFF
50+
cmake --build build -j 2 --target pip_install
51+
52+
- name: Update Stubs
53+
run: |
54+
.github/update_stub.sh
55+
56+
- name: Run pre-commit cleanup
57+
run: |
58+
git add .
59+
pre-commit run -a || true
60+
git add .
61+
62+
- name: Update Install
63+
run: |
64+
cmake --build build -j 2 --target pip_install
65+
66+
- name: Unit tests
67+
run: |
68+
mpiexec -np 1 python3 -m pytest tests/
69+
70+
- uses: stefanzweifel/git-auto-commit-action@v4
71+
name: Commit Updated Stub Files
72+
with:
73+
commit_message: Update Stub Files

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🐧 Ubuntu
22

3-
on: [push, pull_request]
3+
on: [workflow_call]
44

55
concurrency:
66
group: ${{ github.ref }}-${{ github.head_ref }}-linux

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 🪟 Windows
22

3-
on: [push, pull_request]
3+
on: [workflow_call]
44

55
concurrency:
66
group: ${{ github.ref }}-${{ github.head_ref }}-windows

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ repos:
3030
args: [--allow-multiple-documents]
3131
- id: check-added-large-files
3232
args: ['--maxkb=40']
33+
exclude: ^.*\.pyi$
3334
- id: requirements-txt-fixer
3435
# - id: fix-encoding-pragma
3536
# exclude: ^noxfile.py$

0 commit comments

Comments
 (0)