diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 107ea557..bfabbec5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -79,420 +79,388 @@ jobs: script: | core.setFailed('Found existing publish workflow: ${{ steps.query-concurrency.outputs.skipped_by.htmlUrl }}') - build_om_linux: + build_manylinux: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ${{ fromJSON(vars.PYTHON_VERSIONS_FOR_RELEASE) }} needs: [precheck] runs-on: ubuntu-latest + container: + image: quay.io/pypa/manylinux2014_x86_64 + options: --user root steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - name: Show Env + run: | + pwd + echo "ROOT_DIR=$PWD" >> $GITHUB_ENV + env + echo "HOME=/root" >> $GITHUB_ENV + + - uses: actions/checkout@v1 + + - name: Install Rust + run: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Set Rust Version + run: | + rustup install ${{ fromJSON(vars.RUST_VERSION) }} + rustup default ${{ fromJSON(vars.RUST_VERSION) }} + + - name: Check Rust Version + run: | + rustc --version + cargo --version + + - name: Install Newer OpenSSL + run: | + curl -O -L https://www.openssl.org/source/openssl-1.1.1w.tar.gz + ls -al openssl-1.1.1w.tar.gz + tar zxf openssl-1.1.1w.tar.gz + cd openssl-1.1.1w + ./config + make + make install + + - name: Save Minor Python Version + run: | + IFS='.' read -r -a SPLIT_VER <<< ${{ matrix.python-version }} + M_VER=${SPLIT_VER[0]}.${SPLIT_VER[1]} + echo $M_VER + echo "PY_M_VER=$M_VER" >> $GITHUB_ENV + + - name: Install libffi for Python 3.12+ + if: ${{ fromJSON(env.PY_M_VER) >= 3.12 }} + run: | + yum install libffi-devel -y + ldconfig + + - name: Install Perl-IPC-cmd + run : | + yum install perl-IPC-Cmd -y + + - name: Install Python + run: | + ls $ROOT_DIR/openssl-1.1.1w + curl -O https://www.python.org/ftp/python/${{ matrix.python-version }}/Python-${{ matrix.python-version }}.tgz + tar zxf Python-${{ matrix.python-version }}.tgz + cd Python-${{ matrix.python-version }} + ./configure --with-openssl=$ROOT_DIR/openssl-1.1.1w --prefix=/root/python --enable-optimizations --enable-shared + make altinstall + + - name: Copy Python Shared Library (Python 3.7) + if: ${{ matrix.python-version == '3.7.17' }} + run: | + echo $PY_M_VER + cd Python-${{ matrix.python-version }} + ls + cp libpython$PY_M_VER\m.so.1.0 /usr/local/lib64/ + - name: Copy Python Shared Library (Python 3.8+ Versions) + if: ${{ matrix.python-version != '3.7.17' }} + run: | + echo $PY_M_VER + cd Python-${{ matrix.python-version }} + ls + cp libpython$PY_M_VER.so.1.0 /usr/local/lib64/ + + # - name: Update LD_LIBRARY_PATH + # run: | + # echo $LD_LIBRARY_PATH + # echo "LD_LIBRARY_PATH=/Python-${{ matrix.python-version }}:$LD_LIBRARY_PATH" >> $GITHUB_ENV + + - name: Check LD_LIBRARY_PATH + run: | + echo $LD_LIBRARY_PATH + + - name: Alias Python and Pip binaries + run: | + echo $PY_M_VER + ls /root/python/bin + ln -s /root/python/bin/python$PY_M_VER /root/python/bin/python + ln -s /root/python/bin/pip$PY_M_VER /root/python/bin/pip + ls /root/python/bin + + - name: Update $PATH + run: | + echo /root/python/bin >> $GITHUB_PATH + + # # TODO: For now use pre-installed python version. + # # In future, will probably want to download latest version + # - name: Set Python Version (3.7 Path) + # if: ${{ matrix.python-version == 3.7 }} + # run: | + # PYVER=$(echo ${{ matrix.python-version }} | sed -e "s/\.//g") + # echo $PYVER + # PATH_TO_PY=/opt/python/cp$PYVER-cp$PYVER\m/bin + # echo $PATH_TO_PY + # echo "$PATH_TO_PY" >> $GITHUB_PATH + # - name: Set Python Version + # if: ${{ matrix.python-version != 3.7 }} + # run: | + # PYVER=$(echo ${{ matrix.python-version }} | sed -e "s/\.//g") + # echo $PYVER + # PATH_TO_PY=/opt/python/cp$PYVER-cp$PYVER/bin + # echo $PATH_TO_PY + # echo "$PATH_TO_PY" >> $GITHUB_PATH + + - name: Display Python Version + run: | + which python + which pip + python --version + pip --version + + - name: Install Poetry + run: | + pip install poetry==1.3.2 + poetry --version + + - name: Install Auditwheel + run: | + pip install setuptools + pip install auditwheel + auditwheel --version + + - name: Build Origen Metal Python Package + working-directory: python/origen_metal + run: poetry build --format wheel + + - name: Display OM Dist Directory + working-directory: python/origen_metal + run: ls dist + + - name: Repair OM Wheel + working-directory: python/origen_metal + run: | + auditwheel show dist/* + auditwheel repair dist/* + + - name: Display OM Wheelhouse Directory + working-directory: python/origen_metal + run: | + ls wheelhouse + echo "OM_WHEEL=$( ls wheelhouse | head -1 )" >> $GITHUB_ENV + + - name: Display OM Wheel Name + run: | + echo ${{ env.OM_WHEEL }} + + - name: Upload Origen Metal Python Package Artifact + uses: actions/upload-artifact@v1 with: - python-version: 3.9 - architecture: x64 - - name: Add build system to pyproject.toml + name: om_wheels + # path: python/origen_metal/wheelhouse/* + path: python/origen_metal/wheelhouse/${{ env.OM_WHEEL }} + + - name: Get OM Python Package Version working-directory: python/origen_metal + run: poetry version -s > ${{ env.om_ver_file }} + + - name: Upload OM Python Package Version + uses: actions/upload-artifact@v1 + with: + name: ${{ env.om_ver_file }} + path: python/origen_metal/${{ env.om_ver_file }} + + - name: Build Origen Python Package + working-directory: python/origen + run: poetry build --format wheel + + - name: Display Origen Dist Directory + working-directory: python/origen + run: ls dist + + - name: Repair Origen Wheel + working-directory: python/origen + run: | + auditwheel show dist/* + auditwheel repair dist/* + + - name: Display Origen Wheelhouse Directory + working-directory: python/origen + run: | + ls wheelhouse + echo "ORIGEN_WHEEL=$( ls wheelhouse | head -1 )" >> $GITHUB_ENV + + - name: Display Origen Wheelhouse Directory + run: | + ls -al python/origen/origen/__bin__/bin + ls -al rust/pyapi/target/release + echo ${{ env.ORIGEN_WHEEL }} + + - name: Upload Origen Python Package Artifact + uses: actions/upload-artifact@v1 + with: + name: origen_wheels + # path: python/origen/wheelhouse/* + path: python/origen/wheelhouse/${{ env.ORIGEN_WHEEL }} + + - name: Get Origen Python Package Version + working-directory: python/origen + run: poetry version -s > ${{ env.origen_ver_file }} + + - name: Upload Origen Python Package Version + uses: actions/upload-artifact@v1 + with: + name: ${{ env.origen_ver_file }} + path: python/origen/${{ env.origen_ver_file }} + + - name: Upload CLI as a standalone entity + uses: actions/upload-artifact@v1 + with: + name: cli + path: python/origen/origen/__bin__/bin/origen + + build_windows: + strategy: + fail-fast: false + matrix: + python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }} + needs: [precheck] + + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ fromJSON(vars.RUST_VERSION) }} + rustflags: + + - name: Override Project Rust Version + run: rustup override set ${{ fromJSON(vars.RUST_VERSION) }} + + - name: Check Rust Version run: | - echo "[build-system]" >> pyproject.toml - echo "requires = [\"maturin>=1.0,<2.0\"]" >> pyproject.toml - echo "build-backend = \"maturin\"" >> pyproject.toml - - name: Build wheels - uses: PyO3/maturin-action@v1 + rustc --version + cargo --version + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - target: x86_64 - manylinux: auto - # This is required to fix an SSL build error - before-script-linux: yum install perl-IPC-Cmd -y - args: --release --strip --out om_dist --manifest-path rust/pyapi_metal/Cargo.toml --interpreter python${{ matrix.python-version }} + python-version: ${{ matrix.python-version }} + + - name: Display Python Version + run: python -c "import sys; print(sys.version)" + - name: Install Poetry run: | pip install poetry==1.3.2 poetry --version + + - name: Build Origen Metal Python Package + working-directory: python/origen_metal + run: poetry build --format wheel + + - name: Display Dist Directory + working-directory: python/origen_metal/dist + run: ls + + - name: Upload Origen Metal Python Package Artifact + uses: actions/upload-artifact@v3 + with: + name: om_wheels + path: python/origen_metal/dist/origen_metal* + - name: Get OM Python Package Version working-directory: python/origen_metal run: poetry version -s > ${{ env.om_ver_file }} - - name: Upload wheels + + - name: Upload OM Python Package Version uses: actions/upload-artifact@v3 with: - name: om_wheels - path: om_dist/* - - # SMcG - Couldn't get this to work with the manylinux2014_x86_64 container, I think the approach of running everything - # inside the manylinux container is wrong since many current Github action packages will not run in it. - # I've fixed what I can and it gets far enough to build the wheels, but hit a roadblock since the actions/upload-artifact - # step needs v1 to run in the container but this doesn't support the current Github actions workspace path - # - # I've switched the OM build to use the Maturin action instead and I would recommend that the Origen job does similar - # in the future, it should be possible to include extra files like the origen binary in the wheel with Maturin. - - #build_manylinux: - # strategy: - # fail-fast: false - # matrix: - # python-version: ${{ fromJSON(vars.PYTHON_VERSIONS_FOR_RELEASE) }} - # needs: [precheck] - # runs-on: ubuntu-latest - # container: - # image: quay.io/pypa/manylinux2014_x86_64 - # options: --user root - # steps: - # - name: Show Env - # run: | - # pwd - # echo "ROOT_DIR=$PWD" >> $GITHUB_ENV - # env - # echo "HOME=/root" >> $GITHUB_ENV - - # - uses: actions/checkout@v1 - - # - name: Install Rust - # run: | - # curl https://sh.rustup.rs -sSf | sh -s -- -y - # echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - # - name: Set Rust Version - # run: | - # rustup install ${{ fromJSON(vars.RUST_VERSION) }} - # rustup default ${{ fromJSON(vars.RUST_VERSION) }} - - # - name: Check Rust Version - # run: | - # rustc --version - # cargo --version - - # - name: Install Newer OpenSSL - # run: | - # curl -O -L https://www.openssl.org/source/openssl-1.1.1w.tar.gz - # ls -al openssl-1.1.1w.tar.gz - # tar zxf openssl-1.1.1w.tar.gz - # cd openssl-1.1.1w - # ./config - # make - # make install - - # - name: Save Minor Python Version - # run: | - # IFS='.' read -r -a SPLIT_VER <<< ${{ matrix.python-version }} - # M_VER=${SPLIT_VER[0]}.${SPLIT_VER[1]} - # echo $M_VER - # echo "PY_M_VER=$M_VER" >> $GITHUB_ENV - - # - name: Install libffi for Python 3.12+ - # if: ${{ fromJSON(env.PY_M_VER) >= 3.12 }} - # run: | - # yum install libffi-devel -y - # ldconfig - - # - name: Install Python - # run: | - # ls $ROOT_DIR/openssl-1.1.1w - # curl -O https://www.python.org/ftp/python/${{ matrix.python-version }}/Python-${{ matrix.python-version }}.tgz - # tar zxf Python-${{ matrix.python-version }}.tgz - # cd Python-${{ matrix.python-version }} - # ./configure --with-openssl=$ROOT_DIR/openssl-1.1.1w --prefix=/root/python --enable-optimizations --enable-shared - # make altinstall - - # - name: Copy Python Shared Library (Python 3.7) - # if: ${{ matrix.python-version == '3.7.17' }} - # run: | - # echo $PY_M_VER - # cd Python-${{ matrix.python-version }} - # ls - # cp libpython$PY_M_VER\m.so.1.0 /usr/local/lib64/ - # - name: Copy Python Shared Library (Python 3.8+ Versions) - # if: ${{ matrix.python-version != '3.7.17' }} - # run: | - # echo $PY_M_VER - # cd Python-${{ matrix.python-version }} - # ls - # cp libpython$PY_M_VER.so.1.0 /usr/local/lib64/ - # - # # - name: Update LD_LIBRARY_PATH - # # run: | - # # echo $LD_LIBRARY_PATH - # # echo "LD_LIBRARY_PATH=/Python-${{ matrix.python-version }}:$LD_LIBRARY_PATH" >> $GITHUB_ENV - - # - name: Check LD_LIBRARY_PATH - # run: | - # echo $LD_LIBRARY_PATH - - # - name: Alias Python and Pip binaries - # run: | - # echo $PY_M_VER - # ls /root/python/bin - # ln -s /root/python/bin/python$PY_M_VER /root/python/bin/python - # ln -s /root/python/bin/pip$PY_M_VER /root/python/bin/pip - # ls /root/python/bin - - # - name: Update $PATH - # run: | - # echo /root/python/bin >> $GITHUB_PATH - - # # # TODO: For now use pre-installed python version. - # # # In future, will probably want to download latest version - # # - name: Set Python Version (3.7 Path) - # # if: ${{ matrix.python-version == 3.7 }} - # # run: | - # # PYVER=$(echo ${{ matrix.python-version }} | sed -e "s/\.//g") - # # echo $PYVER - # # PATH_TO_PY=/opt/python/cp$PYVER-cp$PYVER\m/bin - # # echo $PATH_TO_PY - # # echo "$PATH_TO_PY" >> $GITHUB_PATH - # # - name: Set Python Version - # # if: ${{ matrix.python-version != 3.7 }} - # # run: | - # # PYVER=$(echo ${{ matrix.python-version }} | sed -e "s/\.//g") - # # echo $PYVER - # # PATH_TO_PY=/opt/python/cp$PYVER-cp$PYVER/bin - # # echo $PATH_TO_PY - # # echo "$PATH_TO_PY" >> $GITHUB_PATH - - # - name: Display Python Version - # run: | - # which python - # which pip - # python --version - # pip --version - - # - name: Install Poetry - # run: | - # pip install poetry==1.3.2 - # poetry --version - - # - name: Install Auditwheel - # run: | - # pip install setuptools - # pip install auditwheel - # auditwheel --version - - # - name: Install Perl dep for ssl build - # run: | - # yum install perl-IPC-Cmd -y - - # - name: Build Origen Metal Python Package - # working-directory: python/origen_metal - # run: poetry build --format wheel - - # - name: Display OM Dist Directory - # working-directory: python/origen_metal - # run: ls dist - - # - name: Repair OM Wheel - # working-directory: python/origen_metal - # run: | - # auditwheel show dist/* - # auditwheel repair dist/* - - # - name: Display OM Wheelhouse Directory - # working-directory: python/origen_metal - # run: ls wheelhouse - - # - name: Upload Origen Metal Python Package Artifact - # uses: actions/upload-artifact@v1 - # with: - # name: om_wheels - # path: python/origen_metal/wheelhouse/* - - # - name: Get OM Python Package Version - # working-directory: python/origen_metal - # run: poetry version -s > ${{ env.om_ver_file }} - - # - name: Upload OM Python Package Version - # uses: actions/upload-artifact@v1 - # with: - # name: ${{ env.om_ver_file }} - # path: python/origen_metal/${{ env.om_ver_file }} - - # - name: Build Origen Python Package - # working-directory: python/origen - # run: poetry build --format wheel - - # - name: Display Origen Dist Directory - # working-directory: python/origen - # run: ls dist - - # - name: Repair Origen Wheel - # working-directory: python/origen - # run: | - # auditwheel show dist/* - # auditwheel repair dist/* - - # - name: Display Origen Wheelhouse Directory - # working-directory: python/origen - # run: ls wheelhouse - - # - name: Upload Origen Python Package Artifact - # uses: actions/upload-artifact@v1 - # with: - # name: origen_wheels - # path: python/origen/wheelhouse/* - - # - name: Get Origen Python Package Version - # working-directory: python/origen - # run: poetry version -s > ${{ env.origen_ver_file }} - # - # - name: Upload Origen Python Package Version - # uses: actions/upload-artifact@v1 - # with: - # name: ${{ env.origen_ver_file }} - # path: python/origen/${{ env.origen_ver_file }} - - # - name: Upload CLI as a standalone entity - # uses: actions/upload-artifact@v1 - # with: - # name: cli - # path: python\origen\origen\__bin__\bin\origen - - #build_windows: - # strategy: - # fail-fast: false - # matrix: - # python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }} - # needs: [precheck] - - # runs-on: windows-latest - # steps: - # - uses: actions/checkout@v2 - - # - name: Install Rust - # uses: actions-rust-lang/setup-rust-toolchain@v1 - # with: - # toolchain: ${{ fromJSON(vars.RUST_VERSION) }} - # rustflags: - - # - name: Override Project Rust Version - # run: rustup override set ${{ fromJSON(vars.RUST_VERSION) }} - - # - name: Check Rust Version - # run: | - # rustc --version - # cargo --version - - # - name: Setup Python ${{ matrix.python-version }} - # uses: actions/setup-python@v4 - # with: - # python-version: ${{ matrix.python-version }} - - # - name: Display Python Version - # run: python -c "import sys; print(sys.version)" - - # - name: Install Poetry - # run: | - # pip install poetry==1.3.2 - # poetry --version - - # - name: Build Origen Metal Python Package - # working-directory: python/origen_metal - # run: poetry build --format wheel - - # - name: Display Dist Directory - # working-directory: python/origen_metal/dist - # run: ls - - # - name: Upload Origen Metal Python Package Artifact - # uses: actions/upload-artifact@v3 - # with: - # name: om_wheels - # path: python/origen_metal/dist/origen_metal* - - # - name: Get OM Python Package Version - # working-directory: python/origen_metal - # run: poetry version -s > ${{ env.om_ver_file }} - - # - name: Upload OM Python Package Version - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.om_ver_file }} - # path: python/origen_metal/${{ env.om_ver_file }} - - # # - name: Build Origen CLI - # # working-directory: rust/origen/cli - # # run: cargo build --bins --release - # - # # - name: Add Origen to PATH (Linux) - # # if: matrix.os == 'ubuntu-latest' - # # run: echo "${{ github.workspace }}/rust/origen/target/release" >> $GITHUB_PATH - - # # - name: Add Origen to PATH (Windows) - # # if: matrix.os == 'windows-latest' - # # run: echo "${{ github.workspace }}/rust/origen/target/release" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - # # - name: Display Origen CLI Version - # # run: origen -v - - # # - name: Build PyAPI - # # working-directory: rust/pyapi - # # run: cargo build --release - - # # - name: Setup App Env - # # working-directory: python - # # run: origen env setup - - # # - name: Display Origen App Version - # # working-directory: python - # # run: origen -v - - # - name: Build Origen Python Package - # working-directory: python/origen - # run: poetry build --format wheel - - # - name: Display Dist Directory - # working-directory: python/origen/dist - # run: ls - - # - name: Upload Origen Python Package Artifact - # uses: actions/upload-artifact@v3 - # with: - # name: origen_wheels - # path: python/origen/dist/origen* - - # - name: Get Origen Python Package Version - # working-directory: python/origen - # run: poetry version -s > ${{ env.origen_ver_file }} - # - # - name: Upload Origen Python Package Version - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ env.origen_ver_file }} - # path: python/origen/${{ env.origen_ver_file }} - # - # # - name: "Publish To PyPi" - # # if: ${{ github.event.inputs.publish_pypi }} == true - # # working_directory: python - # # run: | - # # echo "Publishing to PyPi" - # # # poetry publish ... - - # # - name: "Publish To PyPi Test Server" - # # if: ${{ github.event.inputs.publish_pypi_test == 'true' }} - # # working-directory: python - # # run: | - # # echo "Publishing to PyPi Test Server" - # # poetry config repositories.pypi-test https://test.pypi.org/legacy/ - # # poetry config pypi-token.pypi-test ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }} - # # poetry publish -r pypi-test - - # # - name: pypi-publish - # # if: ${{ github.event.inputs.publish_pypi_test == 'true' }} - # # uses: pypa/gh-action-pypi-publish@v1.4.2 - # # with: - # # packages_dir: python/dist/ - # # user: __token__ - # # password: ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }} - # # repository_url: https://test.pypi.org/legacy/ - # # skip_existing: true - - # # - name: "Publish To Github Releases" - # # if: ${{ github.event.inputs.publish_github_release }} == true - # # working_directory: python - # # run: | - # # echo "Publishing to Github Releases" - # # # ... + name: ${{ env.om_ver_file }} + path: python/origen_metal/${{ env.om_ver_file }} + + # - name: Build Origen CLI + # working-directory: rust/origen/cli + # run: cargo build --bins --release + + # - name: Add Origen to PATH (Linux) + # if: matrix.os == 'ubuntu-latest' + # run: echo "${{ github.workspace }}/rust/origen/target/release" >> $GITHUB_PATH + + # - name: Add Origen to PATH (Windows) + # if: matrix.os == 'windows-latest' + # run: echo "${{ github.workspace }}/rust/origen/target/release" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + # - name: Display Origen CLI Version + # run: origen -v + + # - name: Build PyAPI + # working-directory: rust/pyapi + # run: cargo build --release + + # - name: Setup App Env + # working-directory: python + # run: origen env setup + + # - name: Display Origen App Version + # working-directory: python + # run: origen -v + + - name: Build Origen Python Package + working-directory: python/origen + run: poetry build --format wheel + + - name: Display Dist Directory + working-directory: python/origen/dist + run: ls + + - name: Upload Origen Python Package Artifact + uses: actions/upload-artifact@v3 + with: + name: origen_wheels + path: python/origen/dist/origen* + + - name: Get Origen Python Package Version + working-directory: python/origen + run: poetry version -s > ${{ env.origen_ver_file }} + + - name: Upload Origen Python Package Version + uses: actions/upload-artifact@v3 + with: + name: ${{ env.origen_ver_file }} + path: python/origen/${{ env.origen_ver_file }} + + # - name: "Publish To PyPi" + # if: ${{ github.event.inputs.publish_pypi }} == true + # working_directory: python + # run: | + # echo "Publishing to PyPi" + # # poetry publish ... + + # - name: "Publish To PyPi Test Server" + # if: ${{ github.event.inputs.publish_pypi_test == 'true' }} + # working-directory: python + # run: | + # echo "Publishing to PyPi Test Server" + # poetry config repositories.pypi-test https://test.pypi.org/legacy/ + # poetry config pypi-token.pypi-test ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }} + # poetry publish -r pypi-test + + # - name: pypi-publish + # if: ${{ github.event.inputs.publish_pypi_test == 'true' }} + # uses: pypa/gh-action-pypi-publish@v1.4.2 + # with: + # packages_dir: python/dist/ + # user: __token__ + # password: ${{ secrets.PYPI_TEST_SERVER_API_TOKEN }} + # repository_url: https://test.pypi.org/legacy/ + # skip_existing: true + + # - name: "Publish To Github Releases" + # if: ${{ github.event.inputs.publish_github_release }} == true + # working_directory: python + # run: | + # echo "Publishing to Github Releases" + # # ... show_wheels: - needs: [build_om_linux] #, build_windows] + needs: [build_manylinux, build_windows] runs-on: ubuntu-latest steps: - name: Retrieve OM Wheels @@ -504,23 +472,23 @@ jobs: - name: List OM Wheels run: ls -al ./om_wheels - #- name: Retrieve Origen Wheels - # uses: actions/download-artifact@v3 - # with: - # name: origen_wheels - # path: origen_wheels + - name: Retrieve Origen Wheels + uses: actions/download-artifact@v3 + with: + name: origen_wheels + path: origen_wheels - #- name: List Origen Wheels - # run: ls -al ./origen_wheels + - name: List Origen Wheels + run: ls -al ./origen_wheels - #- name: Upload CLI as a standalone entity - # uses: actions/upload-artifact@v3 - # with: - # name: cli - # path: python\origen\origen\__bin__\bin\origen.exe + - name: Upload CLI as a standalone entity + uses: actions/upload-artifact@v3 + with: + name: cli + path: python\origen\origen\__bin__\bin\origen.exe publish_to_pypi_test: - needs: [build_om_linux] #, build_windows] + needs: [build_manylinux, build_windows] runs-on: ubuntu-latest if: ${{ github.event.inputs.publish_pypi_test == 'true' }} steps: @@ -563,7 +531,7 @@ jobs: verbose: true publish_to_pypi: - needs: [build_om_linux] #, build_windows] + needs: [build_manylinux, build_windows] runs-on: ubuntu-latest if: ${{ github.event.inputs.publish_pypi == 'true' }} steps: @@ -578,33 +546,33 @@ jobs: - name: Push To PyPi Server if: ${{ github.event.inputs.origen_metal_python_package == 'true' }} - uses: pypa/gh-action-pypi-publish@v1.9.0 + uses: pypa/gh-action-pypi-publish@v1.8.10 with: packages-dir: om_wheels password: ${{ secrets.PYPI_OM_API_TOKEN }} verify-metadata: false verbose: true - #- name: Retrieve Wheels - # uses: actions/download-artifact@v3 - # with: - # name: origen_wheels - # path: origen_wheels + - name: Retrieve Wheels + uses: actions/download-artifact@v3 + with: + name: origen_wheels + path: origen_wheels - #- name: List Origen Wheels - # run: ls -al ./origen_wheels + - name: List Origen Wheels + run: ls -al ./origen_wheels - #- name: Push To PyPi Server - # if: ${{ github.event.inputs.origen_python_package == 'true' }} - # uses: pypa/gh-action-pypi-publish@v1.9.0 - # with: - # packages-dir: origen_wheels - # password: ${{ secrets.PYPI_ORIGEN_API_TOKEN }} - # verify-metadata: false - # verbose: true + - name: Push To PyPi Server + if: ${{ github.event.inputs.origen_python_package == 'true' }} + uses: pypa/gh-action-pypi-publish@v1.8.10 + with: + packages-dir: origen_wheels + password: ${{ secrets.PYPI_ORIGEN_API_TOKEN }} + verify-metadata: false + verbose: true publish_github_release: - needs: [build_om_linux] #, build_windows] + needs: [build_manylinux, build_windows] runs-on: ubuntu-latest if: ${{ github.event.inputs.publish_github_release == 'true' }} steps: @@ -688,7 +656,7 @@ jobs: commit: ${{ github.sha }} tag: ${{ env.tag }} cleanup: - needs: [precheck, build_om_linux, publish_to_pypi_test, publish_to_pypi, publish_github_release, show_wheels] # , build_windows + needs: [precheck, build_manylinux, build_windows, publish_to_pypi_test, publish_to_pypi, publish_github_release, show_wheels] runs-on: ubuntu-latest if: ${{ always() }} steps: diff --git a/.github/workflows/regression_test.yml b/.github/workflows/regression_test.yml index 4af4d5a1..0fb8e7b2 100644 --- a/.github/workflows/regression_test.yml +++ b/.github/workflows/regression_test.yml @@ -217,7 +217,8 @@ jobs: - name: Setup No-App Env uses: Wandalen/wretry.action@v1.3.0 with: - attempt_limit: 2 + attempt_limit: 3 + attempt_delay: 10000 # ms = 10 seconds current_path: test_apps/python_no_app command: poetry install @@ -317,8 +318,12 @@ jobs: # Issue being that working on a newer Python version than what's released will not resolve # Workaround by removing origen_metal package from origen dependencies and installing separately - name: Hack origen pyproject - working-directory: python/origen - run: poetry remove origen_metal + uses: Wandalen/wretry.action@v1.3.0 + with: + attempt_limit: 3 + attempt_delay: 10000 # ms = 10 seconds + current_path: python/origen + command: poetry remove origen_metal - name: Install Origen Packages run: | diff --git a/python/origen/origen/__init__.py b/python/origen/origen/__init__.py index 547f5980..2120db8f 100644 --- a/python/origen/origen/__init__.py +++ b/python/origen/origen/__init__.py @@ -68,6 +68,8 @@ def __getattr__(name: str): return origen._plugins else: return _plugins + elif name == "output_directory" or name == "output_dir": + return _origen.output_directory() raise AttributeError(f"module {__name__!r} has no attribute {name!r}") # Replace origen_metal's native _origen_metal built library diff --git a/python/origen/origen/application.py b/python/origen/origen/application.py index 9421b6b0..fadfab56 100644 --- a/python/origen/origen/application.py +++ b/python/origen/origen/application.py @@ -94,7 +94,7 @@ def commands_dir(self): return None @property - def session(self): + def app_session(self): ''' Return this app's session store''' return origen.sessions.app_session(self) @@ -103,6 +103,14 @@ def user_session(self): ''' Return this app's user session store''' return origen.sessions.user_session(self) + @property + def session(self): + ''' If in an application workspace, return the this app's app session, otherwise this app's user session''' + if origen.app: + return self.app_session + else: + return self.user_session + @property def rc(self): return origen_metal.frontend.frontend().revision_control diff --git a/python/origen/origen/boot.py b/python/origen/origen/boot.py index 02452585..25e9e322 100644 --- a/python/origen/origen/boot.py +++ b/python/origen/origen/boot.py @@ -33,7 +33,6 @@ def run_cmd(command, -------- * :link-to:`Example Application Commands ` ''' - import origen import _origen import origen_metal @@ -47,13 +46,13 @@ def run_cmd(command, arg_indices = {} if command == dispatch_plugin_cmd: - cmd_src = "plugin" + cmd_src = _origen.current_command.SourceType.Plugin elif command == dispatch_aux_cmd: - cmd_src = "aux_ns" + cmd_src = _origen.current_command.SourceType.Aux elif command == dispatch_app_cmd: - cmd_src = "app" + cmd_src = _origen.current_command.SourceType.App else: - cmd_src = "core" + cmd_src = _origen.current_command.SourceType.Core dispatch = {} def wrap_mod_from_file(path): @@ -62,7 +61,7 @@ def wrap_mod_from_file(path): except Exception as e: return [path, e] - def mod_from_modulized_path(root, sub_parts): + def find_mod(root, sub_parts): root = pathlib.Path(root) if not root.exists(): return [f"Root directory '{root}' does not exists or is not accessible"] @@ -76,7 +75,7 @@ def mod_from_modulized_path(root, sub_parts): if modulized_path.exists(): path = pathlib.Path(f"{modulized_path}/{'.'.join(sub_parts[(i+1):])}.py") if path.exists(): - return wrap_mod_from_file(path) + return path else: paths.append(path) else: @@ -84,7 +83,13 @@ def mod_from_modulized_path(root, sub_parts): return [f"From root '{root}', searched:", *[p.relative_to(root) for p in paths]] else: return [f"From root '{root}', searched:", *[p.relative_to(root) for p in paths]] - return wrap_mod_from_file(path) + return path + + def mod_from_modulized_path(root, sub_parts): + m = find_mod(root, sub_parts) + if isinstance(m, list): + return m + return wrap_mod_from_file(m) def call_user_cmd(cmd_type): m = mod_from_modulized_path(dispatch_root, subcmds) @@ -92,7 +97,8 @@ def call_user_cmd(cmd_type): if isinstance(m, list): if isinstance(m[1], Exception): origen.log.error(f"Could not load {cmd_type} command implementation from '{('.').join(subcmds)}' ({m[0]})") - origen.log.error(f"Received exception:\n{m[1]}") + import traceback + origen.log.error(f"Received exception:\n{''.join(traceback.format_exception(m[1]))}") else: origen.log.error(f"Could not find implementation for {cmd_type} command '{('.').join(subcmds)}'") for msg in m: @@ -182,13 +188,13 @@ def run(func): for ext in extensions: current_ext = ext - if cmd_src == "core": + if cmd_src.is_core_cmd: _dispatch_src = [command] - elif cmd_src == "app": + elif cmd_src.is_app_cmd: _dispatch_src = [] else: _dispatch_src = [dispatch_src] - m = mod_from_modulized_path(ext['root'], [cmd_src, *_dispatch_src, *subcmds]) + m = mod_from_modulized_path(ext['root'], [cmd_src.root_name, *_dispatch_src, *subcmds]) if isinstance(m, list): if len(m) == 2 and isinstance(m[1], Exception): origen.log.error(f"Could not load {ext['source']} extension implementation from '{ext['name']}' ({m[0]})") @@ -208,7 +214,20 @@ def run(func): if "on_load" in ext: getattr((ext["mod"]), ext["on_load"])(ext["mod"]) current_ext = None - _origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions) + if cmd_src.is_core_cmd: + _origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions, cmd_src, None, None) + else: + path = find_mod(dispatch_root, subcmds) + if isinstance(path, list): + if isinstance(path[1], Exception): + origen.log.error(f"Could not load {cmd_src} command implementation from '{('.').join(subcmds)}' ({path[0]})") + origen.log.error(f"Received exception:\n{path[1]}") + else: + origen.log.error(f"Could not find implementation for {cmd_src} command '{('.').join(subcmds)}'") + for msg in path: + origen.log.error(f" {msg}") + exit_proc(1) + _origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions, cmd_src, path, dispatch_src) def run_ext(phase, continue_on_fail=False): for ext in extensions: @@ -416,7 +435,6 @@ def tabify(message): print("Error") print(tabify(repr(e))) - elif command == dispatch_app_cmd: call_user_cmd("app") diff --git a/python/origen/origen/core/plugins.py b/python/origen/origen/core/plugins.py index 718d6f3a..86c868fb 100644 --- a/python/origen/origen/core/plugins.py +++ b/python/origen/origen/core/plugins.py @@ -19,6 +19,9 @@ def from_origen_cli(plugins): origen._plugins = pls return origen._plugins +class Plugin: + pass + class Plugins(UserDict): def __init__(self): UserDict.__init__(self) @@ -33,7 +36,8 @@ def names(self): def register(self, name): a = importlib.import_module(f'{name}.application') - app = a.Application(root=Path(os.path.abspath( + a_pl = type("Application", (Plugin, a.Application), {}) + app = a_pl(root=Path(os.path.abspath( a.__file__)).parent.parent, name=name) self.data[name] = app diff --git a/python/origen/origen/utility/github.py b/python/origen/origen/utility/github.py index c09302e6..ca13cb5c 100644 --- a/python/origen/origen/utility/github.py +++ b/python/origen/origen/utility/github.py @@ -1,3 +1,3 @@ import _origen -dispatch_workflow = _origen.utility.dispatch_workflow +dispatch_workflow = _origen.utility.revision_control.github.dispatch_workflow diff --git a/python/origen_metal/poetry.lock b/python/origen_metal/poetry.lock index d56d2660..54070aab 100644 --- a/python/origen_metal/poetry.lock +++ b/python/origen_metal/poetry.lock @@ -17,50 +17,31 @@ six = ">=1.6.1,<2.0" wheel = ">=0.23.0,<1.0" [[package]] -name = "atomicwrites" -version = "1.4.1" -description = "Atomic file writes." -category = "dev" +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" files = [ - {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] [[package]] -name = "attrs" -version = "24.1.0" -description = "Classes Without Boilerplate" +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "attrs-24.1.0-py3-none-any.whl", hash = "sha256:377b47448cb61fea38533f671fba0d0f8a96fd58facd4dc518e3dac9dbea0905"}, - {file = "attrs-24.1.0.tar.gz", hash = "sha256:adbdec84af72d38be7628e353a09b6a6790d15cd71819f6e9d7b0faa8a125745"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] -[package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} - [package.extras] -benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] -tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -category = "main" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] +test = ["pytest (>=6)"] [[package]] name = "importlib-metadata" @@ -264,18 +245,6 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] -[[package]] -name = "py" -version = "1.11.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -files = [ - {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, - {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, -] - [[package]] name = "pygments" version = "2.17.2" @@ -306,29 +275,44 @@ files = [ [[package]] name = "pytest" -version = "6.2.5" +version = "7.4.4" description = "pytest: simple powerful testing with Python" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, - {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] [package.dependencies] -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} -attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" -py = ">=1.8.2" -toml = "*" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-rerunfailures" +version = "13.0" +description = "pytest plugin to re-run tests to eliminate flaky failures" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-rerunfailures-13.0.tar.gz", hash = "sha256:e132dbe420bc476f544b96e7036edd0a69707574209b6677263c950d19b09199"}, + {file = "pytest_rerunfailures-13.0-py3-none-any.whl", hash = "sha256:34919cb3fcb1f8e5d4b940aa75ccdea9661bade925091873b7c6fa5548333069"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=1", markers = "python_version < \"3.8\""} +packaging = ">=17.1" +pytest = ">=7" [[package]] name = "six" @@ -357,18 +341,6 @@ files = [ [package.extras] tests = ["pytest", "pytest-cov"] -[[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" -category = "dev" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -files = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, -] - [[package]] name = "tomli" version = "2.0.1" @@ -427,4 +399,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = ">=3.7.0,<3.13" -content-hash = "e0c2da58da1ba1f95cd43115dc03c4394c5c7dbb8371e12b44d9801e08aba44d" +content-hash = "ba952ac47b206b87d17bdf476f3aa7a34a81bd01653ea5d61deb53e4cab03667" diff --git a/python/origen_metal/pyproject.toml b/python/origen_metal/pyproject.toml index 097cf806..f55e3472 100644 --- a/python/origen_metal/pyproject.toml +++ b/python/origen_metal/pyproject.toml @@ -32,7 +32,8 @@ dependencies = [ ] [tool.poetry.dev-dependencies] -pytest = "^6.2.4" +pytest = "^7" +pytest-rerunfailures = "13.0" # Last version that supports Python 3.7 pdoc = "^7" maturin = "1.7.0" @@ -45,10 +46,9 @@ markers = [ "ldap: marks tests requiring/using the external ldap", ] -# SMcG - Commented out, breaks regression (setting up test/python_app env) -#[tool.poetry.build] -#script = "poetry_build.py" -#generate-setup-file = false +[tool.poetry.build] +script = "poetry_build.py" +generate-setup-file = false [tool.maturin] module-name = "origen_metal._origen_metal" diff --git a/python/origen_metal/setup.py b/python/origen_metal/setup.py deleted file mode 100644 index 8a454938..00000000 --- a/python/origen_metal/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -from setuptools import setup - -packages = \ -['origen_metal', - 'origen_metal._helpers', - 'origen_metal.framework', - 'origen_metal.frontend', - 'origen_metal.utils', - 'origen_metal.utils.revision_control', - 'origen_metal.utils.revision_control.supported'] - -package_data = \ -{'': ['*'], 'origen_metal': ['.pytest_cache/*', '.pytest_cache/v/cache/*']} - -install_requires = \ -['colorama>=0.4.4', 'importlib-metadata>=6.7.0', 'termcolor>=1.1.0'] - -extras_require = \ -{':sys_platform == "win32"': ['pyreadline3>=3.3,<4.0']} - -setup_kwargs = { - 'name': 'origen-metal', - 'version': '0.4.1.dev2', - 'description': 'Bare metal APIs for the Origen SDK', - 'long_description': '', - 'author': 'Origen-SDK', - 'author_email': 'None', - 'maintainer': 'None', - 'maintainer_email': 'None', - 'url': 'https://origen-sdk.org/o2', - 'packages': packages, - 'package_data': package_data, - 'install_requires': install_requires, - 'extras_require': extras_require, - 'python_requires': '>=3.7.0,<3.13', -} -from poetry_build import * -build(setup_kwargs) - -setup(**setup_kwargs) diff --git a/python/origen_metal/tests/utils/test_ldap.py b/python/origen_metal/tests/utils/test_ldap.py index a32ac5d8..894bbbe0 100644 --- a/python/origen_metal/tests/utils/test_ldap.py +++ b/python/origen_metal/tests/utils/test_ldap.py @@ -286,6 +286,7 @@ def u2(self, dummy_config): return dummy_config.u2 @pytest.mark.ldap +@pytest.mark.flaky(reruns=3, reruns_delay=5) # Allow for 3 retries on failed LDAP tests with 5 seconds between tries class TestStandaloneLDAP(Common): def test_ldap_parameters(self, dummy_config): ldap = self.dummy_ldap() @@ -452,6 +453,7 @@ def test_timeout_can_be_set(self): assert ldap.timeout is None @pytest.mark.ldap +@pytest.mark.flaky(reruns=3, reruns_delay=5) class TestLdapAsDataStore(DataStoreView): ''' The LDAP's only data store feature is populating users''' def parameterize(self): @@ -479,6 +481,7 @@ def test_underlying_ldap_search_works(self): @pytest.mark.ldap +@pytest.mark.flaky(reruns=3, reruns_delay=5) class TestAuthSetups: class TestSimpleBind: @pytest.fixture diff --git a/rust/origen/src/utility/github.rs b/rust/origen/src/utility/github.rs index 00796fb2..77a02b5c 100644 --- a/rust/origen/src/utility/github.rs +++ b/rust/origen/src/utility/github.rs @@ -1,6 +1,10 @@ use origen_metal::{Result, Outcome, octocrab, futures}; use std::collections::HashMap; +lazy_static! { + static ref GH_ENV: &'static str = "GITHUB_WORKFLOW"; +} + pub fn with_blocking_calls(mut f: F) -> Result where F: FnMut() -> Result, @@ -29,6 +33,18 @@ pub fn lookup_pat() -> Result { } } +pub fn get_current_workflow_name() -> Result> { + match std::env::var(*GH_ENV) { + Ok(v) => Ok(Some(v)), + Err(e) => match e { + std::env::VarError::NotPresent => { + return Ok(None) + }, + _ => return Err(e.into()) + } + } +} + #[derive(Deserialize, Debug)] pub struct Actor { pub login: String, diff --git a/rust/pyapi/src/current_command.rs b/rust/pyapi/src/current_command.rs index 4636ce3f..2e636ad0 100644 --- a/rust/pyapi/src/current_command.rs +++ b/rust/pyapi/src/current_command.rs @@ -1,6 +1,8 @@ use pyo3::prelude::*; use pyo3::types::{PyDict, PyList}; use super::extensions::Extensions; +use std::path::PathBuf; +use std::fmt; pub const ATTR_NAME: &str = "_current_command_"; @@ -10,6 +12,7 @@ pub fn define(py: Python, m: &PyModule) -> PyResult<()> { subm.add_wrapped(wrap_pyfunction!(set_command))?; // subm.add_wrapped(wrap_pyfunction!(clear_command))?; FEATURE CLI Clearing Current Command subm.add_class::()?; + subm.add_class::()?; m.add_submodule(subm)?; Ok(()) } @@ -28,7 +31,10 @@ fn set_command( ext_args: Py, arg_indices: Py, ext_arg_indices: Py, - exts: &PyList + exts: &PyList, + source_type: SourceType, + source_path: Option, + source_plugin: Option, ) -> PyResult<()> { let cmd = CurrentCommand { base: base_cmd, @@ -36,10 +42,110 @@ fn set_command( args: args, arg_indices: arg_indices, exts: Py::new(py, Extensions::new(py, exts, ext_args, ext_arg_indices)?)?, + source: Py::new(py, CommandSource::new(source_type, source_path, source_plugin))?, }; _origen!(py).setattr(ATTR_NAME, Py::new(py, cmd)?) } +#[pyclass] +#[derive(Clone)] +pub enum SourceType { + Core, Plugin, Aux, App +} + +#[pymethods] +impl SourceType { + #[getter] + fn is_core_cmd(&self) -> bool { + matches!(self, Self::Core) + } + + #[getter] + fn is_plugin_cmd(&self) -> bool { + matches!(self, Self::Plugin) + } + + #[getter] + fn is_aux_cmd(&self) -> bool { + matches!(self, Self::Aux) + } + + #[getter] + fn is_app_cmd(&self) -> bool { + matches!(self, Self::App) + } + + fn __str__(&self) -> &str { + match self { + Self::Core => "core", + Self::Plugin => "plugin", + Self::Aux => "aux", + Self::App => "app", + } + } + + #[getter] + fn root_name(&self) -> &str { + match self { + Self::Core => "core", + Self::Plugin => "plugin", + Self::Aux => "aux_ns", + Self::App => "app", + } + } +} + +impl fmt::Display for SourceType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let source_type_str = match self { + SourceType::Core => "Core", + SourceType::Plugin => "Plugin", + SourceType::Aux => "Aux", + SourceType::App => "App", + }; + write!(f, "{}", source_type_str) + } +} + +#[pyclass] +pub struct CommandSource { + source_type: SourceType, + path: Option, + plugin: Option, // Store plugin name and getter will return actual plugin +} + +impl CommandSource { + pub fn new(source_type: SourceType, path: Option, plugin: Option) -> Self { + Self { + source_type: source_type, + path: path, + plugin: plugin + } + } +} + +#[pymethods] +impl CommandSource { + #[getter] + fn source_type(&self) -> PyResult { + Ok(self.source_type.clone()) + } + + #[getter] + fn path(&self) -> PyResult> { + Ok(self.path.as_ref()) + } + + #[getter] + fn plugin<'py>(&'py self, py: Python<'py>) -> PyResult> { + if let Some(pl) = self.plugin.as_ref() { + Ok(Some(get_plugin!(py, pl))) + } else { + Ok(None) + } + } +} + // FEATURE CLI Clearing Current Command // #[pyfunction] // fn clear_command() -> PyResult<()> { @@ -47,12 +153,14 @@ fn set_command( // } #[pyclass] +#[derive(Debug)] pub struct CurrentCommand { base: String, subcmds: Vec, args: Py, arg_indices: Py, exts: Py, + source: Py, } #[pymethods] @@ -90,4 +198,46 @@ impl CurrentCommand { pub fn arg_indices<'py>(&'py self, py: Python<'py>) -> PyResult<&'py PyDict> { Ok(self.arg_indices.as_ref(py)) } + + #[getter] + pub fn command_source<'py>(&'py self, _py: Python<'py>) -> PyResult<&Py> { + Ok(&self.source) + } + + #[getter] + pub fn source<'py>(&'py self, py: Python<'py>) -> PyResult<&Py> { + self.command_source(py) + } + + pub fn __str__<'py>(&'py self, py: Python<'py>) -> PyResult { + let src_type = self.source.as_ref(py).borrow().source_type()?; + let mut s = format!( + "Showing Current Command:\n \ + base command: {}\n \ + sub-commands: {}\n \ + args: {}\n \ + arg-indices: {}\n \ + extensions: {}\n \ + source-type: {}", + self.base, + self.subcmds.join(", "), + self.args.as_ref(py).str()?, + self.arg_indices.as_ref(py).str()?, + self.exts.as_ref(py).call_method0("keys")?.str()?, + &src_type, + ); + match src_type { + SourceType::Core => {}, + SourceType::App | SourceType::Aux | SourceType::Plugin => { + s += &format!("\n source-path: {}", self.source.as_ref(py).borrow().path.as_ref().unwrap().display()) + } + } + match src_type { + SourceType::Core | SourceType::App => {}, + SourceType::Aux | SourceType::Plugin => { + s += &format!("\n source-plugin: {}", self.source.as_ref(py).borrow().plugin.as_ref().unwrap()) + } + } + Ok(s) + } } \ No newline at end of file diff --git a/rust/pyapi/src/macros.rs b/rust/pyapi/src/macros.rs index 73931a4d..c9db5b44 100644 --- a/rust/pyapi/src/macros.rs +++ b/rust/pyapi/src/macros.rs @@ -3,3 +3,17 @@ macro_rules! _origen { pyo3::types::PyModule::import($py, "_origen")? }; } + +macro_rules! origen { + ($py: expr) => { + pyo3::types::PyModule::import($py, "origen")? + }; +} + +macro_rules! get_plugin { + ($py: expr, $plugin: expr) => {{ + let m = pyo3::types::PyModule::import($py, "origen")?; + let pls = m.getattr("plugins")?; + pls.get_item($plugin)? + }}; +} diff --git a/rust/pyapi/src/utility/mod.rs b/rust/pyapi/src/utility/mod.rs index d87ad95e..80f9b5c2 100644 --- a/rust/pyapi/src/utility/mod.rs +++ b/rust/pyapi/src/utility/mod.rs @@ -24,7 +24,6 @@ use origen::utility::big_uint_helpers::BigUintHelpers; use pyo3::types::PyDict; use std::collections::HashMap; use std::path::PathBuf; -use pyapi_metal::PyOutcome; pub fn define(py: Python, m: &PyModule) -> PyResult<()> { let subm = PyModule::new(py, "utility")?; @@ -32,7 +31,6 @@ pub fn define(py: Python, m: &PyModule) -> PyResult<()> { subm.add_class::()?; subm.add_wrapped(wrap_pyfunction!(reverse_bits))?; subm.add_wrapped(wrap_pyfunction!(exec))?; - subm.add_wrapped(wrap_pyfunction!(dispatch_workflow))?; sessions::define(py, subm)?; revision_control::define(py, subm)?; unit_testers::define(py, subm)?; @@ -170,15 +168,3 @@ fn app_utility( } } -#[pyfunction] -#[pyo3(signature=(owner, repo, workflow, git_ref, inputs=None))] -pub fn dispatch_workflow( - owner: &str, - repo: &str, - workflow: &str, - git_ref: &str, - inputs: Option>, -) -> PyResult { - let res = origen::utility::github::dispatch_workflow(owner, repo, workflow, git_ref, inputs)?; - Ok(PyOutcome::from_origen(res)) -} diff --git a/rust/pyapi/src/utility/revision_control/github.rs b/rust/pyapi/src/utility/revision_control/github.rs new file mode 100644 index 00000000..f0a70f31 --- /dev/null +++ b/rust/pyapi/src/utility/revision_control/github.rs @@ -0,0 +1,29 @@ +use pyo3::prelude::*; +use pyapi_metal::PyOutcome; +use std::collections::HashMap; + +pub fn define(py: Python, m: &PyModule) -> PyResult<()> { + let subm = PyModule::new(py, "github")?; + subm.add_wrapped(wrap_pyfunction!(get_current_workflow_name))?; + subm.add_wrapped(wrap_pyfunction!(dispatch_workflow))?; + m.add_submodule(subm)?; + Ok(()) +} + +#[pyfunction] +pub fn get_current_workflow_name() -> PyResult> { + Ok(origen::utility::github::get_current_workflow_name()?) +} + +#[pyfunction] +#[pyo3(signature=(owner, repo, workflow, git_ref, inputs=None))] +pub fn dispatch_workflow( + owner: &str, + repo: &str, + workflow: &str, + git_ref: &str, + inputs: Option>, +) -> PyResult { + let res = origen::utility::github::dispatch_workflow(owner, repo, workflow, git_ref, inputs)?; + Ok(PyOutcome::from_origen(res)) +} diff --git a/rust/pyapi/src/utility/revision_control/mod.rs b/rust/pyapi/src/utility/revision_control/mod.rs index 680603b3..27e77255 100644 --- a/rust/pyapi/src/utility/revision_control/mod.rs +++ b/rust/pyapi/src/utility/revision_control/mod.rs @@ -1,3 +1,5 @@ +pub mod github; + use pyapi_metal::utils::revision_control::supported::git::PY_GIT_MOD_PATH; use pyo3::prelude::*; @@ -12,6 +14,7 @@ use crate::runtime_error; pub fn define(py: Python, m: &PyModule) -> PyResult<()> { let subm = PyModule::new(py, "revision_control")?; subm.add_wrapped(wrap_pyfunction!(app_rc))?; + github::define(py, subm)?; m.add_submodule(subm)?; Ok(()) } diff --git a/rust/pyapi_metal/pyproject.toml b/rust/pyapi_metal/pyproject.toml deleted file mode 120000 index e095ff7a..00000000 --- a/rust/pyapi_metal/pyproject.toml +++ /dev/null @@ -1 +0,0 @@ -../../python/origen_metal/pyproject.toml \ No newline at end of file diff --git a/rust/pyapi_metal/pyproject.toml b/rust/pyapi_metal/pyproject.toml new file mode 100644 index 00000000..188467d7 --- /dev/null +++ b/rust/pyapi_metal/pyproject.toml @@ -0,0 +1,9 @@ +[tool.maturin] +module-name = "origen_metal._origen_metal" + +# # This needs to be present to build for Linux, but does not work +# # for the current Windows build flow +# # This is currently added back in by the Linux Github actions job +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" diff --git a/test_apps/no_workspace/README.md b/test_apps/no_workspace/README.md index 0915725d..bee38372 100644 --- a/test_apps/no_workspace/README.md +++ b/test_apps/no_workspace/README.md @@ -1,4 +1,4 @@ -No-Workspace tests require some setup to run. This can custom pyenv can be setup for this, or manual changes can be made. A similar sequence is contained in `regression_test.yml`. +No-Workspace tests require some setup to run. A custom pyenv can be setup for this, or manual changes can be made. A similar sequence is contained in `regression_test.yml`. ### Ensure the origen plugin is up to date with the latest executable and `pyapi`: ~~~ @@ -9,6 +9,8 @@ cd ../pyapi cargo build # For linux cp target/debug/lib_origen.so ../../python/origen/_origen.so +# For Windows + cp .\target\debug\_origen.dll ..\..\python\origen\_origen.pyd ~~~ ### Clean origen_metal tmp/ directory @@ -35,7 +37,7 @@ pip install python/origen_metal ~~~ ### Install Pytest -`pytest` is currently just a development dependency. Need to instal it manually: +`pytest` is currently just a development dependency. Need to install it manually: ~~~ pip install pytest==7.2.1 diff --git a/test_apps/no_workspace/t_invocation_env.py b/test_apps/no_workspace/t_invocation_env.py index e3339931..92c0edeb 100644 --- a/test_apps/no_workspace/t_invocation_env.py +++ b/test_apps/no_workspace/t_invocation_env.py @@ -1,5 +1,7 @@ # Use the local origen/origen_metal - actual tests should be done through 'eval', which will use the installed packages. import sys, pathlib + +import origen.helpers p = pathlib.Path(__file__).parent.parent.parent.joinpath("python/origen") sys.path.append(str(p)) sys.path.append(str(p.parent.joinpath("origen_metal"))) @@ -11,6 +13,8 @@ from types import ModuleType from pathlib import Path, PosixPath, WindowsPath +ta_helpers = origen.helpers.mod_from_file(str(pathlib.Path(__file__).parent.parent.joinpath("test_apps_shared_test_helpers/test_apps_shared_test_helpers/__init__.py")), "ta_helpers") + sys.path.append(str(pathlib.Path(__file__).parent.parent.joinpath("test_apps_shared_test_helpers/test_apps_shared_test_helpers/cli"))) from dirs import o2_root, cli_dir @@ -110,7 +114,21 @@ def setup_method(cls): if cls.target_pyproj_dir: subprocess.run(["pip", "--version"], check=True, cwd=cls.target_pyproj_dir) subprocess.run(["poetry", "--version"], check=True, cwd=cls.target_pyproj_dir) - subprocess.run(["poetry", "install"], check=True, cwd=cls.target_pyproj_dir) + install_tries = 0 + while True: + print(ta_helpers.is_gh_regressions) + print(_origen.utility.revision_control.github.get_current_workflow_name()) + try: + subprocess.run(["poetry", "install"], check=True, cwd=cls.target_pyproj_dir) + break + except subprocess.CalledProcessError as e: + if ta_helpers.is_gh_regressions: + install_tries += 1 + print(f"Failed install attempt #{install_tries} for GH actions") + if install_tries == 3: + raise e + else: + raise e @classmethod def teardown_method(cls): diff --git a/test_apps/python_app/poetry.lock b/test_apps/python_app/poetry.lock index 054317e4..a78ce183 100644 --- a/test_apps/python_app/poetry.lock +++ b/test_apps/python_app/poetry.lock @@ -948,7 +948,7 @@ importlib-metadata = ">= 1.7.0" Jinja2 = "^3" mako = "1.1.0" origen_autoapi = "2.0.1" -origen_metal = "~0.4.1.dev1" +origen_metal = "~0.4.1.dev2" poetry = "^1.1.14" recommonmark = ">= 0" sphinx = "3.0.2" @@ -977,7 +977,7 @@ sphinx = "*" [[package]] name = "origen-metal" -version = "0.4.1.dev1" +version = "0.4.1-dev4" description = "Bare metal APIs for the Origen SDK" category = "main" optional = false @@ -1306,6 +1306,23 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "pytest-rerunfailures" +version = "13.0" +description = "pytest plugin to re-run tests to eliminate flaky failures" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-rerunfailures-13.0.tar.gz", hash = "sha256:e132dbe420bc476f544b96e7036edd0a69707574209b6677263c950d19b09199"}, + {file = "pytest_rerunfailures-13.0-py3-none-any.whl", hash = "sha256:34919cb3fcb1f8e5d4b940aa75ccdea9661bade925091873b7c6fa5548333069"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=1", markers = "python_version < \"3.8\""} +packaging = ">=17.1" +pytest = ">=7" + [[package]] name = "python-plugin" version = "0.1.0" @@ -1773,6 +1790,7 @@ develop = true origen = {path = "../../python/origen", develop = true} pl_ext_cmds = {path = "../pl_ext_cmds", develop = true} pytest = ">=7.2.1" +pytest-rerunfailures = "13.0" [package.source] type = "directory" diff --git a/test_apps/python_no_app/poetry.lock b/test_apps/python_no_app/poetry.lock index c17a3534..1989435b 100644 --- a/test_apps/python_no_app/poetry.lock +++ b/test_apps/python_no_app/poetry.lock @@ -868,7 +868,7 @@ importlib-metadata = ">= 1.7.0" Jinja2 = "^3" mako = "1.1.0" origen_autoapi = "2.0.1" -origen_metal = "~0.4.1.dev1" +origen_metal = "~0.4.1.dev2" poetry = "^1.1.14" recommonmark = ">= 0" sphinx = "3.0.2" @@ -897,7 +897,7 @@ sphinx = "*" [[package]] name = "origen-metal" -version = "0.4.1.dev1" +version = "0.4.1-dev4" description = "Bare metal APIs for the Origen SDK" category = "main" optional = false @@ -1221,6 +1221,23 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "pytest-rerunfailures" +version = "13.0" +description = "pytest plugin to re-run tests to eliminate flaky failures" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-rerunfailures-13.0.tar.gz", hash = "sha256:e132dbe420bc476f544b96e7036edd0a69707574209b6677263c950d19b09199"}, + {file = "pytest_rerunfailures-13.0-py3-none-any.whl", hash = "sha256:34919cb3fcb1f8e5d4b940aa75ccdea9661bade925091873b7c6fa5548333069"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=1", markers = "python_version < \"3.8\""} +packaging = ">=17.1" +pytest = ">=7" + [[package]] name = "python-plugin" version = "0.1.0" @@ -1706,6 +1723,7 @@ develop = true origen = {path = "../../python/origen", develop = true} pl_ext_cmds = {path = "../pl_ext_cmds", develop = true} pytest = ">=7.2.1" +pytest-rerunfailures = "13.0" [package.source] type = "directory" diff --git a/test_apps/python_no_app/tests/test_current_command.py b/test_apps/python_no_app/tests/test_current_command.py index 196d8063..d64e1809 100644 --- a/test_apps/python_no_app/tests/test_current_command.py +++ b/test_apps/python_no_app/tests/test_current_command.py @@ -1,27 +1,55 @@ -import origen, pytest +import origen, pytest, pathlib from types import SimpleNamespace from test_apps_shared_test_helpers.cli import CLIShared, CmdOpt, CmdArg class TestCurrentCommand(CLIShared): @classmethod def parse_current_cmd(cls, out): + def quote(s): + return f"r'{s}'" out = out.split("Start Action For CMD: display_current_command\n")[1].split("End Action For CMD: display_current_command")[0].split("\n")[:-1] print(out) assert out[0] == "Class: CurrentCommand" + assert out[1] == "Command Src Class: CommandSource" + assert out[2] == "Src Type Class: SourceType" + assert out[3] == "Src Plugin Class: Application" + offset = 3 return SimpleNamespace(**{ - "base_cmd": out[1].split("Base Cmd: ")[1], - "subcmds": eval(out[2].split("Sub Cmds: ")[1]), - "args": eval(out[3].split("Args: ")[1]), - "exts": eval(out[4].split("Exts: ")[1]), + "base_cmd": out[offset + 1].split("Base Cmd: ")[1], + "subcmds": eval(out[offset + 2].split("Sub Cmds: ")[1]), + "args": eval(out[offset + 3].split("Args: ")[1]), + "arg_indices": eval(out[offset + 4].split("Arg Indices: ")[1]), + "exts": eval(out[offset + 5].split("Exts: ")[1]), + "src_path": eval(quote(out[offset + 6].split("Src Path: ")[1])), + "src_plugin": eval(quote(out[offset + 7].split("Src Plugin: ")[1])), + "src_type": eval(quote(out[offset + 8].split("Src Type: ")[1])), + "is_core_cmd": eval(out[offset + 9].split("Src is_core_cmd: ")[1]), + "is_plugin_cmd": eval(out[offset + 10].split("Src is_plugin_cmd: ")[1]), + "is_aux_cmd": eval(out[offset + 11].split("Src is_aux_cmd: ")[1]), + "is_app_cmd": eval(out[offset + 12].split("Src is_app_cmd: ")[1]), + "src_root_name": eval(quote(out[offset + 13].split("Src root name: ")[1])), }) + # TEST_NEEDED: CurrentCommand need a better way to handle and test other sources @classmethod - def assert_current_cmd(cls, out, base, subcmds, args, exts): + def assert_current_cmd(cls, out, base, subcmds, args, arg_indices, exts, path, src, src_name): cmd = cls.parse_current_cmd(out) assert cmd.base_cmd == base assert cmd.subcmds == subcmds assert cmd.args == args + assert cmd.arg_indices == arg_indices assert cmd.exts == exts + assert pathlib.Path(cmd.src_path) == path + if src == "plugin": + assert cmd.src_plugin == src_name + assert cmd.src_type == "plugin" + assert not cmd.is_core_cmd + assert cmd.is_plugin_cmd + assert not cmd.is_aux_cmd + assert not cmd.is_app_cmd + assert cmd.src_root_name == "plugin" + else: + RuntimeError("Currently only plugin sources are supported") def test_current_command_is_none(self): assert origen.current_command is None @@ -33,12 +61,17 @@ def test_current_command_from_core_cmd(self): def test_current_command_from_pl_cmd(self): out = self.python_plugin.do_actions.run("display_current_command") + f = origen.plugins["python_plugin"].root.joinpath("python_plugin/commands/do_actions.py") self.assert_current_cmd( out, "_plugin_dispatch_", ["do_actions"], {"actions": ['display_current_command']}, - {} + {'actions': [1]}, + {}, + f, + "plugin", + "python_plugin" ) def test_arg_indices(self): diff --git a/test_apps/python_no_app/tests/test_plugin_loading.py b/test_apps/python_no_app/tests/test_plugin_loading.py index 445306f7..97714f63 100644 --- a/test_apps/python_no_app/tests/test_plugin_loading.py +++ b/test_apps/python_no_app/tests/test_plugin_loading.py @@ -43,6 +43,7 @@ def test_plugins_are_accessible(self): assert pls.names == self.plugins.python_no_app_config_pl_names # TODO assert isinstance(pl, origen.application.Base) + assert isinstance(pl, origen.core.plugins.Plugin) # assert isinstance(pl, _origen.plugins.Plugin) # TODO assert pl.is_plugin == True diff --git a/test_apps/test_apps_shared_test_helpers/pyproject.toml b/test_apps/test_apps_shared_test_helpers/pyproject.toml index 013eb91b..019e1766 100644 --- a/test_apps/test_apps_shared_test_helpers/pyproject.toml +++ b/test_apps/test_apps_shared_test_helpers/pyproject.toml @@ -7,11 +7,11 @@ authors = ["Origen-SDK"] [tool.poetry.dependencies] python = ">=3.7.0,<3.13" pytest = ">=7.2.1" +pytest-rerunfailures = "13.0" # Last version that supports Python 3.7 origen = { path = "../../python/origen", develop = true } pl_ext_cmds = { path = "../pl_ext_cmds", develop = true } [tool.poetry.dev-dependencies] -pytest = "^3" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/__init__.py b/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/__init__.py new file mode 100644 index 00000000..18f9078d --- /dev/null +++ b/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/__init__.py @@ -0,0 +1,5 @@ +import _origen + +REGRESSIONS_WORKFLOW_NAME = "Regression Tests" + +is_gh_regressions = (_origen.utility.revision_control.github.get_current_workflow_name() == REGRESSIONS_WORKFLOW_NAME) diff --git a/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/cli/ext_helpers.py b/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/cli/ext_helpers.py index 70e0b547..c939b3a8 100644 --- a/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/cli/ext_helpers.py +++ b/test_apps/test_apps_shared_test_helpers/test_apps_shared_test_helpers/cli/ext_helpers.py @@ -78,10 +78,24 @@ def do_action(actions, phase): elif action == "display_current_command": cc = origen.current_command print(f"Class: {cc.__class__.__name__}") + cs = cc.source + print(f"Command Src Class: {cs.__class__.__name__}") + st = cs.source_type + print(f"Src Type Class: {st.__class__.__name__}") + print(f"Src Plugin Class: {cs.plugin.__class__.__name__}") print(f"Base Cmd: {cc.base_cmd}") print(f"Sub Cmds: {cc.subcmds}") print(f"Args: {cc.args}") + print(f"Arg Indices: {cc.arg_indices}") print(f"Exts: {dict(cc.exts)}") + print(f"Src Path: {cs.path}") + print(f"Src Plugin: {cs.plugin.name}") + print(f"Src Type: {st}") + print(f"Src is_core_cmd: {st.is_core_cmd}") + print(f"Src is_plugin_cmd: {st.is_plugin_cmd}") + print(f"Src is_aux_cmd: {st.is_aux_cmd}") + print(f"Src is_app_cmd: {st.is_app_cmd}") + print(f"Src root name: {st.root_name}") elif action == "show_ext_mods": # TEST_NEEDED CLI check for extension mods for n, e in origen.current_command.exts.items():