Installing BenchPress
January 31, 2024 ยท View on GitHub
There are two general ways to install BenchPress:
-
Install from the PowerShell Gallery
-
Import from a local copy of the BenchPress GitHub repository
Install From the PowerShell Gallery
In order to install from the PowerShell Gallery follow these steps from a PowerShell terminal:
- Ensure that the latest version of PowerShellGet is installed.
- Execute
Install-Module -Name BenchPress.Azure - To make the module available to the current session execute
Import-Module -Name BenchPress.Azure
Install From a Local Copy of the Repository
Copy the Repo to the Local File System
A local copy of the git repository must be present by either cloning from the source GitHub repository or forking the source GitHub repository and cloning that repository locally.
To fork the repository you must have a GitHub account and follow these steps:
- Navigate to the BenchPress GitHub page.
- Click the
Forkbutton in the top right hand corner of the page. - Follow the instructions to fork the BenchPress repository into your own GitHub account.
To clone the repository:
- From a terminal window navigate to the directory that the cloned repository will be cloned.
- If cloning from the source repository execute:
git clone https://github.com/Azure/benchpress.git. This will automatically create thebenchpressfolder and copy all files to the local file system. - If cloning from a forked repository:
- Navigate to the forked repository's
Codepage in GitHub. - Click the
Codebutton drop down and under theHTTPStab copy the URL. - In the terminal window execute
git clone <copied path>. As above, this will copy all files to the local file system.
- Navigate to the forked repository's
Install the BenchPress Module from the Local File System
Once a local copy of the BenchPress repository exists, to install the BenchPress Module, from the project root path execute ./build.ps1 -Import. This will create a .psm1 file in the bin directory that will dot source all cmdlets in the Public and Private folders, Export-ModuleMember for all Public cmdlets, and sets the proper using statements to import classes.
To clean the bin folder before outputting the artifacts from build.ps1 the -Clean flag can be passed.
To test the load time the -Load flag can be passed.
To test the build as an inline .psm1 file pass the -InLine flag. This will consolidate all files in the Classes, Public, and Private folders into a single file instead of dot sourcing the files.