This directory contains GitHub Actions workflows for CI/CD automation of the UserPreferenceSolution.
Main workflow that runs on every push to main/develop branches and pull requests.
Jobs:
- Build and Test: Builds all projects, runs tests, and publishes artifacts
- Deploy Infrastructure: Deploys Azure resources using Bicep templates
- Deploy Blazor: Deploys Blazor WASM to Azure Storage static website
Triggers:
- Push to main/develop branches
- Pull requests to main/develop branches
- Manual workflow dispatch
Dedicated workflow for running tests on pull requests and pushes.
Features:
- Matrix testing with different .NET versions
- Code coverage collection
- Integration with Codecov
Security scanning workflow that runs weekly and on security-related changes.
Features:
- Dependency vulnerability scanning
- Security audit
- Snyk integration
- Scheduled weekly runs
Dedicated workflow for Azure infrastructure deployment.
Features:
- Bicep template validation
- Infrastructure deployment
- Manual environment selection
- Deployment outputs
Set these secrets in your GitHub repository settings:
AZURE_CREDENTIALS # Service principal credentials (JSON)
AZURE_RESOURCE_GROUP # Target resource group name
AZURE_LOCATION # Azure region (e.g., eastus)
AZURE_WEBAPP_PUBLISH_PROFILE # Web App publish profile
AZURE_FUNCTIONAPP_PUBLISH_PROFILE # Functions publish profile
AZURE_STORAGE_ACCOUNT # Storage account name
SNYK_TOKEN # Snyk API token (optional)
az ad sp create-for-rbac --name "github-actions" --role contributor \
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \
--sdk-auth
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Add the required secrets listed above
- Go to Settings → Branches
- Add rule for
main
branch - Enable "Require status checks to pass before merging"
- Select the required status checks:
build-and-test
test
security-scan
- Push to main: Full CI/CD pipeline
- Push to develop: Build and test only
- Pull Request: Test suite and security scan
- Infrastructure changes: Infrastructure validation and deployment
- CI/CD Pipeline: Manual deployment trigger
- Infrastructure Deployment: Manual infrastructure deployment with environment selection
- Check Actions tab for workflow execution status
- View detailed logs for each step
- Monitor deployment progress
- Azure Authentication: Verify service principal permissions
- Build Failures: Check .NET version compatibility
- Deployment Errors: Verify Azure resource group and permissions
- Secret Issues: Ensure all required secrets are properly configured