Skip to content

Commit c9f37a1

Browse files
committed
Added GH actions workflow steps
1 parent 74c6aed commit c9f37a1

File tree

1 file changed

+81
-1
lines changed

1 file changed

+81
-1
lines changed

articles/load-testing/tutorial-cicd-azure-pipelines.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,86 @@ To create and run the load test, the Azure Pipelines definition uses the [Azure
277277
278278
# [GitHub Actions](#tab/github)
279279
280+
You'll create a GitHub Actions workflow in your fork of the sample application repository. This repository contains the following items:
281+
282+
- The sample application source code.
283+
- The *.github/workflows/workflow.yml* GitHub Actions workflow.
284+
- The *SampleApp.jmx* JMeter test script.
285+
- The *SampleApp.yaml* Azure Load Testing configuration file.
286+
287+
To create and run the load test, the GitHub Actions workflow uses the [Azure Load Testing Action](https://github.com/marketplace/actions/azure-load-testing) from the GitHub Actions Marketplace.
288+
289+
The sample application repository already contains a sample workflow file *.github/workflows/workflow.yml*. The GitHub Actions workflow performs the following steps for every update to the main branch:
290+
291+
292+
- Invoke Azure Load Testing by using the [Azure Load Testing Action](https://github.com/marketplace/actions/azure-load-testing) and the sample Apache JMeter script *SampleApp.jmx* and the load test configuration file *SampleApp.yaml*.
293+
294+
1. Open the *.github/workflows/workflow.yml* GitHub Actions workflow file in your sample application's repository.
295+
296+
1. Notice the `loadTest` job, which creates and runs the load test:
297+
298+
- The `azure/login` action authenticates with Azure, by using the `AZURE_CREDENTIALS` secret to pass the service principal credentials.
299+
300+
```yml
301+
- name: Login to Azure
302+
uses: azure/login@v1
303+
continue-on-error: false
304+
with:
305+
creds: ${{ secrets.AZURE_CREDENTIALS }}
306+
```
307+
308+
- The `azure/arm-deploy` action deploys a new Azure load testing resource in your Azure subscription.
309+
310+
```yml
311+
- name: Create Azure Load Testing resource
312+
uses: azure/arm-deploy@v1
313+
with:
314+
resourceGroupName: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
315+
template: ./ARMTemplate/template.json
316+
parameters: ./ARMTemplate/parameters.json name=${{ env.LOAD_TEST_RESOURCE }} location="${{ env.LOCATION }}"
317+
```
318+
319+
- The `azure/load-testing` [Azure Load Testing Action](https://github.com/marketplace/actions/azure-load-testing) creates and starts a load test. This action uses the `SampleApp.yaml` [load test configuration file](./reference-test-config-yaml.md), which contains the configuration parameters for the load test, such as the number of parallel test engines.
320+
321+
```yml
322+
- name: 'Azure Load Testing'
323+
uses: azure/load-testing@v1
324+
with:
325+
loadTestConfigFile: 'SampleApp.yaml'
326+
loadTestResource: ${{ env.LOAD_TEST_RESOURCE }}
327+
resourceGroup: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
328+
env: |
329+
[
330+
{
331+
"name": "webapp",
332+
"value": "${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net"
333+
}
334+
]
335+
```
336+
337+
If a load test already exists, the `azure/load-testing` action won't create a new load test, but will add a test run to this load test. To identify regressions over time, you can then [compare multiple test runs](./how-to-compare-multiple-test-runs.md).
338+
339+
1. Replace the following placeholder text at the beginning of the workflow definition file:
340+
341+
These variables are used to configure the deployment of the sample application, and to create the load test.
342+
343+
|Placeholder |Value |
344+
|---------|---------|
345+
|`<Name of your webapp>` | The name of the Azure App Service web app. |
346+
|`<Name of your load test resource>` | The name of your Azure Load Testing resource. |
347+
|`<Name of your load test resource group>` | The name of the resource group that contains the Azure Load Testing resource. |
348+
349+
```yaml
350+
env:
351+
AZURE_WEBAPP_NAME: "<Name of your webapp>" # set this to your application's name
352+
LOAD_TEST_RESOURCE: "<Name of your load test resource>"
353+
LOAD_TEST_RESOURCE_GROUP: "<Name of your load test resource group>"
354+
```
355+
356+
1. Commit your changes to the main branch.
357+
358+
The commit will trigger the GitHub Actions workflow in your repository. Verify that the workflow is running by going to the **Actions** tab.
359+
280360
---
281361
282362
## View load test results
@@ -295,7 +375,7 @@ To view the results of the load test in the pipeline log:
295375
296376
After the load test finishes, you can view the test summary information and the client-side metrics in the pipeline log. The log also shows the URL to go to the Azure Load Testing dashboard for this load test.
297377
298-
2. In the pipeline log view, select **Load Test**, and then select **1 artifact produced** to download the result files for the load test.
378+
1. In the pipeline log view, select **Load Test**, and then select **1 artifact produced** to download the result files for the load test.
299379
300380
:::image type="content" source="./media/tutorial-cicd-azure-pipelines/create-pipeline-download-results.png" alt-text="Screenshot that shows how to download the load test results.":::
301381

0 commit comments

Comments
 (0)