|
| 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 |
0 commit comments