@@ -25,183 +25,183 @@ env:
2525jobs :
2626 # Bicep Validation and Linting
2727 bicep-validation :
28+ if : ${{ github.event_name == 'push' }}
2829 runs-on : ubuntu-latest
2930 name : ' Bicep Validation'
30-
3131 steps :
32- - name : Checkout
33- uses : actions/checkout@v4
32+ - name : Checkout
33+ uses : actions/checkout@v4
3434
35- - name : Setup Azure CLI
36- uses : azure/setup-azure-cli@v1
35+ - name : Setup Azure CLI
36+ uses : azure/setup-azure-cli@v1
3737
38- - name : Azure CLI Login
39- uses : azure/login@v1
40- with :
41- creds : ${{ secrets.AZURE_CREDENTIALS }}
38+ - name : Azure CLI Login
39+ uses : azure/login@v1
40+ with :
41+ creds : ${{ secrets.AZURE_CREDENTIALS }}
4242
43- - name : Install Bicep CLI
44- run : az bicep install
43+ - name : Install Bicep CLI
44+ run : az bicep install
4545
46- - name : Bicep Build and Validate
47- run : |
48- cd AzureArchitecture
49- echo "Building main.bicep..."
50- az bicep build --file main.bicep
51-
52- echo "Building deploymentStampLayer.bicep..."
53- az bicep build --file deploymentStampLayer.bicep
54-
55- echo "Building globalLayer.bicep..."
56- az bicep build --file globalLayer.bicep --ignore-warnings
57-
58- echo "Building regionalLayer.bicep..."
59- az bicep build --file regionalLayer.bicep --ignore-warnings
46+ - name : Bicep Build and Validate
47+ run : |
48+ cd AzureArchitecture
49+ echo "Building main.bicep..."
50+ az bicep build --file main.bicep
51+
52+ echo "Building deploymentStampLayer.bicep..."
53+ az bicep build --file deploymentStampLayer.bicep
54+
55+ echo "Building globalLayer.bicep..."
56+ az bicep build --file globalLayer.bicep --ignore-warnings
57+
58+ echo "Building regionalLayer.bicep..."
59+ az bicep build --file regionalLayer.bicep --ignore-warnings
6060
61- - name : Bicep What-If Deployment
62- run : |
63- cd AzureArchitecture
64- az deployment group what-if \
65- --resource-group rg-stamps-dev \
66- --template-file main.bicep \
67- --parameters main.parameters.json \
68- --parameters sqlAdminPassword="${{ secrets.SQL_ADMIN_PASSWORD }}"
69- continue-on-error : true
61+ - name : Bicep What-If Deployment
62+ run : |
63+ cd AzureArchitecture
64+ az deployment group what-if \
65+ --resource-group rg-stamps-dev \
66+ --template-file main.bicep \
67+ --parameters main.parameters.json \
68+ --parameters sqlAdminPassword="${{ secrets.SQL_ADMIN_PASSWORD }}"
69+ continue-on-error : true
7070
7171 # .NET Build and Test
7272 dotnet-build-test :
73+ if : ${{ github.event_name == 'push' }}
7374 runs-on : ubuntu-latest
7475 name : ' Build and Test .NET Functions'
75-
7676 steps :
77- - name : Checkout
78- uses : actions/checkout@v4
77+ - name : Checkout
78+ uses : actions/checkout@v4
7979
80- - name : Setup .NET Core
81- uses : actions/setup-dotnet@v3
82- with :
83- dotnet-version : ${{ env.DOTNET_VERSION }}
80+ - name : Setup .NET Core
81+ uses : actions/setup-dotnet@v3
82+ with :
83+ dotnet-version : ${{ env.DOTNET_VERSION }}
8484
85- - name : Restore NuGet packages
86- run : |
87- cd AzureArchitecture
88- dotnet restore AzureArchitecture.sln
85+ - name : Restore NuGet packages
86+ run : |
87+ cd AzureArchitecture
88+ dotnet restore AzureArchitecture.sln
8989
90- - name : Build Functions
91- run : |
92- cd AzureArchitecture
93- dotnet build AzureArchitecture.sln --configuration Release --no-restore
90+ - name : Build Functions
91+ run : |
92+ cd AzureArchitecture
93+ dotnet build AzureArchitecture.sln --configuration Release --no-restore
9494
95- - name : Run Unit Tests
96- run : |
97- cd AzureArchitecture
98- dotnet test Tests/CreateTenantFunctionTests.cs --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage"
95+ - name : Run Unit Tests
96+ run : |
97+ cd AzureArchitecture
98+ dotnet test Tests/CreateTenantFunctionTests.cs --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage"
9999
100- - name : Upload Code Coverage
101- uses : codecov/codecov-action@v3
102- with :
103- files : ./AzureArchitecture/TestResults/*/coverage.cobertura.xml
104- flags : unittests
105- name : stamps-pattern-coverage
100+ - name : Upload Code Coverage
101+ uses : codecov/codecov-action@v3
102+ with :
103+ files : ./AzureArchitecture/TestResults/*/coverage.cobertura.xml
104+ flags : unittests
105+ name : stamps-pattern-coverage
106106
107107 # Security Scanning
108108 security-scan :
109+ if : ${{ github.event_name == 'push' }}
109110 runs-on : ubuntu-latest
110111 name : ' Security and Code Quality'
111-
112112 steps :
113- - name : Checkout
114- uses : actions/checkout@v4
113+ - name : Checkout
114+ uses : actions/checkout@v4
115115
116- - name : Run Bandit Security Scan
117- uses : tj-actions/bandit@v5
118- with :
119- options : " -r . -f json -o bandit-report.json"
120- continue-on-error : true
116+ - name : Run Bandit Security Scan
117+ uses : tj-actions/bandit@v5
118+ with :
119+ options : " -r . -f json -o bandit-report.json"
120+ continue-on-error : true
121121
122- # Enhanced Static Code Analysis with SonarCloud
123- - name : SonarCloud Scan
124- uses : SonarSource/sonarcloud-github-action@master
125- env :
126- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
128- with :
129- args : >
130- -Dsonar.projectKey=azure-stamps-pattern
131- -Dsonar.organization=your-org
132- -Dsonar.sources=AzureArchitecture
133- -Dsonar.exclusions=**/bin/**,**/obj/**
134- -Dsonar.cs.dotcover.reportsPaths=coverage.xml
122+ # Enhanced Static Code Analysis with SonarCloud
123+ - name : SonarCloud Scan
124+ uses : SonarSource/sonarcloud-github-action@master
125+ env :
126+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
128+ with :
129+ args : >
130+ -Dsonar.projectKey=azure-stamps-pattern
131+ -Dsonar.organization=your-org
132+ -Dsonar.sources=AzureArchitecture
133+ -Dsonar.exclusions=**/bin/**,**/obj/**
134+ -Dsonar.cs.dotcover.reportsPaths=coverage.xml
135135
136- - name : Run CodeQL Analysis
137- uses : github/codeql-action/init@v2
138- with :
139- languages : csharp
136+ - name : Run CodeQL Analysis
137+ uses : github/codeql-action/init@v2
138+ with :
139+ languages : csharp
140140
141- - name : Setup .NET Core
142- uses : actions/setup-dotnet@v3
143- with :
144- dotnet-version : ${{ env.DOTNET_VERSION }}
141+ - name : Setup .NET Core
142+ uses : actions/setup-dotnet@v3
143+ with :
144+ dotnet-version : ${{ env.DOTNET_VERSION }}
145145
146- - name : Build for CodeQL
147- run : |
148- cd AzureArchitecture
149- dotnet build AzureArchitecture.sln --configuration Release
146+ - name : Build for CodeQL
147+ run : |
148+ cd AzureArchitecture
149+ dotnet build AzureArchitecture.sln --configuration Release
150150
151- - name : Perform CodeQL Analysis
152- uses : github/codeql-action/analyze@v2
151+ - name : Perform CodeQL Analysis
152+ uses : github/codeql-action/analyze@v2
153153
154- # Automated Penetration Testing
155- - name : OWASP ZAP Security Scan
156- uses : zaproxy/action-baseline@v0.7.0
157- with :
158- target : ' https://fa-stamps-eastus-dev.azurewebsites.net'
159- rules_file_name : ' .zap/rules.tsv'
160- cmd_options : ' -a'
154+ # Automated Penetration Testing
155+ - name : OWASP ZAP Security Scan
156+ uses : zaproxy/action-baseline@v0.7.0
157+ with :
158+ target : ' https://fa-stamps-eastus-dev.azurewebsites.net'
159+ rules_file_name : ' .zap/rules.tsv'
160+ cmd_options : ' -a'
161161
162162 # Load Testing
163163 load-testing :
164+ if : ${{ github.event_name == 'push' }}
164165 runs-on : ubuntu-latest
165166 name : ' Performance and Load Testing'
166-
167167 steps :
168- - name : Checkout
169- uses : actions/checkout@v4
168+ - name : Checkout
169+ uses : actions/checkout@v4
170170
171- - name : Setup k6
172- run : |
173- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
174- echo "deb https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
175- sudo apt-get update
176- sudo apt-get install k6
171+ - name : Setup k6
172+ run : |
173+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
174+ echo "deb https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
175+ sudo apt-get update
176+ sudo apt-get install k6
177177
178- - name : Run Load Tests
179- run : |
180- k6 run --out json=load-test-results.json ./scripts/load-test.js
181- env :
182- TEST_URL : ${{ secrets.TEST_ENDPOINT }}
178+ - name : Run Load Tests
179+ run : |
180+ k6 run --out json=load-test-results.json ./scripts/load-test.js
181+ env :
182+ TEST_URL : ${{ secrets.TEST_ENDPOINT }}
183183
184- - name : Azure Load Testing
185- uses : azure/load-testing@v1
186- with :
187- loadTestConfigFile : ' scripts/azure-load-test.yaml'
188- loadTestResource : ' stamps-load-testing'
189- resourceGroup : ' rg-stamps-dev'
190- env : |
191- [
192- {
193- "name": "webapp_url",
194- "value": "${{ secrets.TEST_ENDPOINT }}"
195- }
196- ]
184+ - name : Azure Load Testing
185+ uses : azure/load-testing@v1
186+ with :
187+ loadTestConfigFile : ' scripts/azure-load-test.yaml'
188+ loadTestResource : ' stamps-load-testing'
189+ resourceGroup : ' rg-stamps-dev'
190+ env : |
191+ [
192+ {
193+ "name": "webapp_url",
194+ "value": "${{ secrets.TEST_ENDPOINT }}"
195+ }
196+ ]
197197
198- - name : Upload Load Test Results
199- uses : actions/upload-artifact@v3
200- with :
201- name : load-test-results
202- path : |
203- load-test-results.json
204- LoadTestResults/
198+ - name : Upload Load Test Results
199+ uses : actions/upload-artifact@v3
200+ with :
201+ name : load-test-results
202+ path : |
203+ load-test-results.json
204+ LoadTestResults/
205205
206206 # Cache Performance Monitoring
207207 cache-monitoring :
0 commit comments