From a385fbc199127ed68f0444698d3dc0172eab8aaa Mon Sep 17 00:00:00 2001 From: Andrea Settimi Date: Fri, 16 Aug 2024 18:35:52 +0200 Subject: [PATCH] WIP: testin sphinx build + artifacts x18 --- .github/workflows/documentation.yml | 143 ++++++++++++++++------------ doc/test_pybind_dll_smoke.py | 7 +- 2 files changed, 86 insertions(+), 64 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4802a76e..935ffb0d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -25,11 +25,13 @@ jobs: run: | conda env create -f environment.yml - - name: Update cache with newly created environment - uses: actions/cache@v2 - with: - path: C:\Miniconda\envs\diff_check - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} + # - name: Update/Restore conda environment cache + # uses: actions/cache@v2 + # with: + # path: C:\Miniconda\envs\diff_check + # key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} + # restore-keys: | + # ${{ runner.os }}-conda- - name: Activate diff_check conda environment run: | @@ -42,71 +44,90 @@ jobs: - name: CMake Build run: conda run --name diff_check --no-capture-output cmake --build build --config Release - - name: Move dlls and pyd files to a single directory - run: | - mkdir $env:GITHUB_WORKSPACE\artifacts - Get-ChildItem -Path $env:GITHUB_WORKSPACE\build\Release -Filter *.pyd -Recurse | Move-Item -Destination $env:GITHUB_WORKSPACE\artifacts - Get-ChildItem -Path $env:GITHUB_WORKSPACE\build\bin\Release -Filter *.dll -Recurse | Move-Item -Destination $env:GITHUB_WORKSPACE\artifacts - shell: pwsh - - name: Store the dlls/pyd as artifacts - uses: actions/upload-artifact@v2 - with: - name: __build_artifacts__ - path: ${{ github.workspace }}/artifacts/* - - - build-docs: - runs-on: windows-latest - needs: build-source - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - lfs: true # enable lfs support - - - name: Setup conda environment - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.9.1 - - - name: Restore conda environment cache - uses: actions/cache@v2 - with: - path: C:\Miniconda\envs\diff_check - key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} - restore-keys: | - ${{ runner.os }}-conda- - - name: Activate diff_check conda environment + # TODO: testing copying + - name: Copying the dlls for python tests and c++ tests run: | - conda activate diff_check + echo "Copying dlls/pyds for sphinx docs" + copy ${{github.workspace}}/build/bin/Release/*.dll ${{github.workspace}}/doc + copy ${{github.workspace}}/build/Release/*.pyd ${{github.workspace}}/doc - - name: Download dlls/pyd artifacts - uses: actions/download-artifact@v2 - with: - name: __build_artifacts__ - path: ${{github.workspace}}/doc + echo "Copying dlls/pyds for python diffCheck package" + copy ${{github.workspace}}/build/bin/Release/*.dll ${{github.workspace}}/src/gh/diffCheck/diffCheck/dlls + copy ${{github.workspace}}/build/Release/*.pyd ${{github.workspace}}/src/gh/diffCheck/diffCheck - # TODO: debug - - name: List all the files in doc/ + - name: Sphinx build run: | - ls doc + invoke documentize - # TODO: testing import with test file test_pybind_dll_smoke.py to remove - - name: tester test_pybind_dll_smoke.py with conda run - run: | - conda run -n diff_check python doc/test_pybind_dll_smoke.py - working-directory: ${{github.workspace}} - - + # # FIXME: uploading artifacts + # - name: Move dlls and pyd files to a single directory + # run: | + # mkdir $env:GITHUB_WORKSPACE\artifacts + # Get-ChildItem -Path $env:GITHUB_WORKSPACE\build\Release -Filter *.pyd -Recurse | Move-Item -Destination $env:GITHUB_WORKSPACE\artifacts + # Get-ChildItem -Path $env:GITHUB_WORKSPACE\build\bin\Release -Filter *.dll -Recurse | Move-Item -Destination $env:GITHUB_WORKSPACE\artifacts + # shell: pwsh + # - name: Store the dlls/pyd as artifacts + # uses: actions/upload-artifact@v2 + # with: + # name: __build_artifacts__ + # path: ${{ github.workspace }}/artifacts/* - - name: Sphinx build - run: | - conda run --name diff_check --no-capture-output sphinx-build doc _build - working-directory: ${{github.workspace}} + + # build-docs: + # runs-on: windows-latest + # needs: build-source + + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # lfs: true # enable lfs support + + # - name: Setup conda environment + # uses: conda-incubator/setup-miniconda@v2 + # with: + # auto-update-conda: true + # python-version: 3.9.1 + + # - name: Restore conda environment cache + # uses: actions/cache@v2 + # with: + # path: C:\Miniconda\envs\diff_check + # key: ${{ runner.os }}-conda-${{ hashFiles('environment.yml') }} + # restore-keys: | + # ${{ runner.os }}-conda- + + # - name: Activate diff_check conda environment + # run: | + # conda activate diff_check + + # - name: Download dlls/pyd artifacts + # uses: actions/download-artifact@v2 + # with: + # name: __build_artifacts__ + # path: ${{github.workspace}}/doc + + # # TODO: debug + # - name: List all the files in doc/ + # run: | + # ls doc + + # # TODO: testing import with test file test_pybind_dll_smoke.py to remove + # - name: tester test_pybind_dll_smoke.py with conda run + # run: | + # conda run -n diff_check python doc/test_pybind_dll_smoke.py + # working-directory: ${{github.workspace}} + + # # - + + + # - name: Sphinx build + # run: | + # conda run --name diff_check --no-capture-output sphinx-build doc _build + # working-directory: ${{github.workspace}} diff --git a/doc/test_pybind_dll_smoke.py b/doc/test_pybind_dll_smoke.py index 3183e817..c1377bfa 100644 --- a/doc/test_pybind_dll_smoke.py +++ b/doc/test_pybind_dll_smoke.py @@ -5,11 +5,12 @@ import sys # Import the C++ bindings -extra_dll_dir = os.path.join(os.path.dirname(__file__), "./") -os.add_dll_directory(extra_dll_dir) # For finding DLL dependencies on Windows +extra_dll_dir = os.path.abspath(os.path.dirname(__file__)) +print(f"extra_dll_dir: {extra_dll_dir}") sys.path.append(extra_dll_dir) # Add this directory to the Python path +# os.add_dll_directory(extra_dll_dir) # For finding DLL dependencies on Windows try: - import diffcheck_bindings as dfb + import diffCheck.diffcheck_bindings as dfb except ImportError as e: print(f"Failed to import diffcheck_bindings: {e}") print("Current sys.path directories:")