Skip to content

Commit

Permalink
add infra test
Browse files Browse the repository at this point in the history
  • Loading branch information
ks6088ts committed Jun 1, 2024
1 parent 01b5470 commit c5c796f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/infra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: infra

on:
push:
paths:
- infra/**
workflow_dispatch:

jobs:
infra:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Log into Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Azure CLI script file
uses: azure/cli@v2
with:
inlineScript: |
cd infra
make ci-test RESOURCE_GROUP_NAME=${{ secrets.AZURE_RG }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![test](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/test.yaml?query=branch%3Amain)
[![infra](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/infra.yaml/badge.svg?branch=main)](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/infra.yaml?query=branch%3Amain)
[![docker](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/docker.yaml/badge.svg?branch=main)](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/docker.yaml?query=branch%3Amain)
[![docker-release](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/docker-release.yaml/badge.svg)](https://github.com/ks6088ts-labs/azure-ai-services-solutions/actions/workflows/docker-release.yaml)

Expand Down
16 changes: 16 additions & 0 deletions infra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,19 @@ deploy: create-resource-group deployment-what-if deployment-create ## deploy res

.PHONY: destroy
destroy: delete-resource-group ## destroy resources

# Generate deployment credentials: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-github-actions?tabs=userlevel%2CCLI#generate-deployment-credentials
.PHONY: create-for-rbac
create-for-rbac: ## create service principal for RBAC
az ad sp create-for-rbac \
--name test-baseline-environment-on-azure-bicep \
--role contributor \
--scopes /subscriptions/$(SUBSCRIPTION_ID)/resourceGroups/$(RESOURCE_GROUP_NAME) \
--sdk-auth > $(OUT_DIR)/azure-credentials.json

# Configure the GitHub secrets: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-github-actions?tabs=userlevel%2CCLI#configure-the-github-secrets
.PHONY: configure-github-secrets
configure-github-secrets: ## configure GitHub secrets
gh secret set AZURE_CREDENTIALS < $(OUT_DIR)/azure-credentials.json
gh secret set AZURE_SUBSCRIPTION --body $(SUBSCRIPTION_ID)
gh secret set AZURE_RG --body $(RESOURCE_GROUP_NAME)

0 comments on commit c5c796f

Please sign in to comment.