Skip to content

Commit

Permalink
Update contributing doc to to include testing information (#4222)
Browse files Browse the repository at this point in the history
* Update to include testing information

* Update
  • Loading branch information
liliankasem authored Jan 8, 2025
1 parent 208362c commit 8961bad
Showing 1 changed file with 52 additions and 5 deletions.
57 changes: 52 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,71 @@
## Running the latest runtime version
### Dependencies

## Dependencies

There is a dependency on the .NET Core tools for the cross platform support. You can [install these here](https://www.microsoft.com/net/core).

To install the required dotnet packages navigate into the repository root and run `dotnet restore`

### Compiling the CLI Tools
## Compiling the CLI Tools

To build the project run `cd src/Azure.Functions.Cli; dotnet build` (note navigating into the src directory is required due to the test suite currently failing to compile on non-windows environments - see below)

### Running against a function app

To test this project against a local function app you can run from that function app's directory

`dotnet run --project PATH_TO_FUNCTIONS_CLI/src/Azure.Functions.Cli start`

where PATH_TO_FUNCTIONS_CLI is the absolute or relative path to the root of this repository.

## Running the Test Suite
You cannot run the test suite at this moment in time using DotNet Core. We will update this file when this becomes possible.
### Running the Test Suite

- Build the solution `dotnet build Azure.Functions.Cli.sln`
- As part of this build, the cli is copied into the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`) - this is what will be used by the tests
- If you wish to override this, you can set the `FUNC_PATH` environment variable to the path of the `func`/`func.exe` you wish to test against
- Run the test suite in Visual Studio Test Explorer or by running `dotnet test` from the `test` project root.
- i.e. `cd test/Azure.Functions.Cli.Tests; dotnet test`

#### Storage Emulator

Some tests, namely E2E, require an Azure storage emulator to be running. You can download the storage emulator [here](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage).

Run the emulator before your run the tests.

> There is a script you can use for this as well, see `tools/start-emulators.ps1`
#### Templates missing

If you see an error saying the templates folder is missing, you can follow either of the following steps:

##### (a)

- Find your offical func instation directory
- i.e. `/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.6610`
- or `%LOCALAPPDATA%\AzureFunctionsTools\Releases\4.69.0\cli_x64\`
- Copy the templates folder to the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`)

##### or (b)

- Update `build/Program.cs` to just add the template nugets and json:

```csharp
Orchestrator
.CreateForTarget(args)
.Then(AddTemplatesNupkgs)
.Then(AddTemplatesJson)
.Run();
```
- Set environment variables required to run the build script
- Windows: `$env:IsReleaseBuild = "false"`
- MacOS: `export IsReleaseBuild=false`
- If using M1/M2, you may need to set the dotnet root as well `export DOTNET_ROOT=/usr/local/share/dotnet/x64`
- Run the build script `build.ps1`
- In the `artifacts` folder, you should find a `templates` folder within any the subfolders here
- Copy the `templates` folder to the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`)

## Contributing to this Repository

### Filing Issues

Filing issues is a great way to contribute to the SDK. Here are some guidelines:
Expand All @@ -27,8 +74,8 @@ Filing issues is a great way to contribute to the SDK. Here are some guidelines:
* Point to a test repository (e.g. hosted on GitHub) that can help reproduce the issue. This works better then trying to describe step by step how to create a repro scenario.
* Github supports markdown, so when filing bugs make sure you check the formatting before clicking submit.


### Submitting Pull Requests

If you don't know what a pull request is read this https://help.github.com/articles/using-pull-requests.

Before we can accept your pull-request you'll need to sign a [Contribution License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement). You can sign ours [here](https://cla2.dotnetfoundation.org). However, you don't have to do this up-front. You can simply clone, fork, and submit your pull-request as usual.
Expand Down

0 comments on commit 8961bad

Please sign in to comment.