Skip to content

Merge pull request #211 from Origen-SDK/rlaj_dev #652

Merge pull request #211 from Origen-SDK/rlaj_dev

Merge pull request #211 from Origen-SDK/rlaj_dev #652

name: Regression Tests
on:
push:
paths-ignore:
# Ignore updates to just the publish action
- '.github/workflows/publish.yml'
# Ignore updates to just version files for Origen/OM/CLI
- 'rust/origen/cli/Cargo.toml'
- 'python/origen/pyproject.toml'
- 'python/origen_metal/pyproject.toml'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.SUPPORTED_OS) }}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3
- name: Show Git Version
run : |
git --version
- 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
# TODO Invocations: Currently some problem with poetry/pip on Windows where dependencies on drives/mounts separate
# from where the pyproject is located cannot be built. Can workaround this in Windows by updating the
# AGENT_TOOLSDIRECTORY/RUNNER_TOOL_CACHE environment variables, but I'm unable to get these to stick across steps
# in GA. Next few steps are all messiness to debug/work around that.
# Not an issue in Linux, so Windows only will be moved. linux will maintained across different drives.
- name: Pre-Python Install Setup (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
$env:RUNNER_TOOL_CACHE = '${{ github.workspace }}' | Split-Path | Join-Path -ChildPath o2_GA_tools
$env:AGENT_TOOLSDIRECTORY = $env:RUNNER_TOOL_CACHE
mkdir $env:RUNNER_TOOL_CACHE
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
ls $env:AGENT_TOOLSDIRECTORY
echo "RUNNER_TOOL_CACHE=$env:RUNNER_TOOL_CACHE"
echo "AGENT_TOOLSDIRECTORY=$env:AGENT_TOOLSDIRECTORY"
echo "RUNNER_TOOL_CACHE=$env:RUNNER_TOOL_CACHE" >> $GITHUB_ENV
echo "AGENT_TOOLSDIRECTORY=$env:AGENT_TOOLSDIRECTORY" >> $GITHUB_ENV
- name: Check ENV Variables (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
echo $RUNNER_TOOL_CACHE
echo $AGENT_TOOLSDIRECTORY
- name: Setup Python ${{ matrix.python-version }}
if: matrix.os != 'windows-latest'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python ${{ matrix.python-version }}
if: matrix.os == 'windows-latest'
uses: actions/setup-python@v4
env:
RUNNER_TOOL_CACHE: D:\a\o2\o2_GA_tools
AGENT_TOOLSDIRECTORY: D:\a\o2\o2_GA_tools
with:
python-version: ${{ matrix.python-version }}
- name: Check Python Install (Windows-Only)
if: matrix.os == 'windows-latest'
run: |
echo $RUNNER_TOOL_CACHE
echo $AGENT_TOOLSDIRECTORY
echo $env:AGENT_TOOLSDIRECTORY
echo $env:RUNNER_TOOL_CACHE
ls $env:AGENT_TOOLSDIRECTORY
python -c "import os; [print(f'{v}: {k}') for v,k in os.environ.items()];"
python -c "import os, sys; print(os.path.dirname(sys.executable))"
# Needed to compile keyring library
# Install taken from keyring library:
# https://github.com/hwchen/keyring-rs/blob/v0.10.1/.github/workflows/ci.yaml#L80-L84
- name: install libdbus
run: |
sudo apt update
sudo apt install libdbus-1-dev
if: contains(matrix.os, 'ubuntu')
- name: Build Origen CLI
working-directory: rust/origen/cli
run: cargo build --bins
- name: Add Origen to PATH (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
echo "${{ github.workspace }}/rust/origen/target/debug" >> $GITHUB_PATH
export PATH="${{ github.workspace }}/rust/origen/target/debug:$PATH"
- name: Add Origen to PATH (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "${{ github.workspace }}/rust/origen/target/debug" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:Path = "${{ github.workspace }}/rust/origen/target/debug;$env:Path"
- name: Display Python Version
run: |
python -c "import sys; print(sys.version)"
pip --version
- name: Display Origen CLI Version
run: origen -v
- name: Build PyAPI
run: origen origen build
- name: Setup App Env
working-directory: test_apps/python_app
run: origen env setup
- name: Display Origen App Version
working-directory: test_apps/python_app
run: origen -v
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
run: which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
run: where.exe origen
- name: Display Poetry Version
working-directory: test_apps/python_app
run: poetry --version
# - name: Install importlib_metadata (Python 3.12)
# run: pip install importlib_metadata
# - name: Cache Poetry Version (Linux)
# if: matrix.os == 'ubuntu-latest'
# working-directory: test_apps/python_app
# run: |
# POETRY_VER=$(python -c "import importlib_metadata; print(importlib_metadata.version('poetry'))")
# echo $POETRY_VER
# echo "poetry_version=$POETRY_VER" >> $GITHUB_ENV
# - name: Cache Poetry Version (Windows)
# if: matrix.os == 'windows-latest'
# working-directory: test_apps/python_app
# run: |
# $POETRY_VER = python -c "import importlib_metadata; print(importlib_metadata.version('poetry'))"
# echo $POETRY_VER
# echo "poetry_version=$POETRY_VER" >> $GITHUB_ENV
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
# TODO GA: Add to build script?
- name: Move Origen executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: cp rust/origen/target/debug/origen python/origen/origen/__bin__/bin
- name: Move Origen executable (Windows)
if: matrix.os == 'windows-latest'
run: cp rust/origen/target/debug/origen.exe python/origen/origen/__bin__/bin
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
- name: Run Python-App Unit Tests
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 2
current_path: test_apps/python_app
command: origen exec pytest -vv
- name: Run Python-App Diff Tests
working-directory: test_apps/python_app
run: origen examples
- name: Setup No-App Env
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 3
attempt_delay: 10000 # ms = 10 seconds
current_path: test_apps/python_no_app
command: poetry install
- name: Display Poetry Version (No-App)
working-directory: test_apps/python_no_app
run: poetry --version
# Copy _origen
- name: Copy Origen Library (Windows)
if: matrix.os == 'windows-latest'
working-directory: .\rust\pyapi\
run: cp .\target\debug\_origen.dll ..\..\python\origen\_origen.pyd
# Copy _origen
- name: Copy Origen Library (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: rust/pyapi
run: cp target/debug/lib_origen.so ../../python/origen/_origen.so
# Debug
- name: Display python/origen directory
working-directory: test_apps/python_no_app
run: ls ../../python/origen
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: test_apps/python_no_app
run: |
which origen
poetry run which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
working-directory: test_apps/python_no_app
run: |
where.exe origen
echo ""
poetry run where.exe origen
- name: Display Origen No-App Version
working-directory: test_apps/python_no_app
run: poetry run origen -vvv
- name: Run Python-No-App Unit Tests
working-directory: test_apps/python_no_app
run: poetry run pytest -vv
- name: Run Rust Tests
if: matrix.python-version == 3.8
working-directory: rust/origen
run: cargo test --workspace
- name: Build PyAPI - Metal
run: origen origen build --metal
- name: Setup Python Env - Metal
working-directory: python/origen_metal
run: poetry install
- name: Run Python Unit Tests - Metal
working-directory: python/origen_metal
run: poetry run pytest -vv
- name: Run Rust Tests - Metal
working-directory: rust/origen_metal
run: cargo test
# Use a global pytest install for invocation tests
- name: Install Pytest
run: pip install pytest==7.2.1 jinja2==3.1.2
- name: Get Pytest Version (Check Install)
run: pytest --version
# - name: Run User-Global Invocation Tests
# working-directory: test_apps/no_workspace
# run: pytest test_user_install.py::TestUserInstall -vv
# TODO GA: Regressions: eventually want to move this into a poetry build step
# For now, manually move the binary. Also keeps us from having to mess with the path across OSs
# 'mv' command should be be fine for both linux & powershell
# Update: remove binary since it is being copied earlier.
- name: Remove Origen executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: rm rust/origen/target/debug/origen
# run: rm rust/origen/target/debug/origen python/origen/origen/__bin__/bin
- name: Remove Origen executable (Windows)
if: matrix.os == 'windows-latest'
run: rm rust/origen/target/debug/origen.exe
# run: rm rust/origen/target/debug/origen.exe python/origen/origen/__bin__/bin
# TODO GA: Regressions: not sure why, but the tmp directory in origen_metal causes some issues
# For now, just removing it.
- name: Remove origen_metal tmp Directory
run: rm python/origen_metal/tmp -r
# TODO GA: Regressions: Need to better handle this
# 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
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: |
pip --version
poetry --version
pip install python/origen
pip install python/origen_metal
- name: Show Origen Binary Location (Linux)
if: matrix.os == 'ubuntu-latest'
run: which origen
- name: Show Origen Binary Location (Windows)
if: matrix.os == 'windows-latest'
run: where.exe origen
# - name: Reinstall Poetry Version
# run: |
# echo ${{ env.poetry_version }}
# poetry --version
# pip install poetry==${{ env.poetry_version }}
# poetry --version
- name: Run User-Global Invocation Tests
working-directory: test_apps/no_workspace
run: pytest test_user_install.py::TestUserInstall -vv
# Should be no pyprojects in the root so far. Start with no-workspace tests
- name: Run No-Workspace-No-Plugins Tests
working-directory: test_apps/no_workspace
run: pytest test_no_workspace.py::TestNoWorkspaceNoPlugins -vv
- name: Install Plugins
run: |
pip install test_apps/test_apps_shared_test_helpers
pip install test_apps/python_plugin
pip install python/origen_metal
- name: Run No-Workspace-With-Plugins Tests
working-directory: test_apps/no_workspace
run: pytest test_no_workspace.py::TestNoWorkspaceWithPlugins -vv
# Leave the no-workspace setup. The global setup should override
- name: Run Global No-Plugins One Above Site-Packages Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallNoPlugins -vv
- name: Run Global With Plugins At Site-Packages Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallWithPlugins -vv
- name: Run Global No-Plugins At CLI Dir
working-directory: test_apps/no_workspace
run: pytest test_global_install.py::TestGlobalInstallAtCliDir -vv
# With global origen available, test user install errors which fall back to the global install
- name: Run User Install Errors - Falling Back To Global Install
working-directory: test_apps/no_workspace
run:
poetry --version
pytest test_user_install.py::TestErrorCasesWithFallback -vv