Update payment services #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Payment API CICD | |
on: | |
push: | |
branches: | |
- azure | |
paths: | |
- .github/workflows/build-and-push-base.yaml | |
- .github/workflows/build-payment-services.yaml | |
- src/PlantBasedPizza.Payments/** | |
- src/shared/** | |
- infra/payments/** | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
ARM_CLIENT_ID: ${{ secrets.PAYMENTS_AZURE_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
ARM_USE_AZUREAD: true | |
jobs: | |
static-analysis: | |
uses: jeastham1993/PlantBasedPizza/.github/workflows/static-analysis.yaml@azure | |
with: | |
service-name: payments | |
directory: ./src/PlantBasedPizza.Payments/ | |
secrets: | |
dd_api_key: ${{secrets.ACA_DD_API_KEY}} | |
dd_app_key: ${{secrets.ACA_DD_APP_KEY}} | |
build-and-push: | |
uses: jeastham1993/PlantBasedPizza/.github/workflows/build-and-push-base.yaml@azure | |
needs: static-analysis | |
with: | |
application-root-folder: ./src/PlantBasedPizza.Payments/ | |
secrets: | |
DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}} | |
DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN}} | |
DD_API_KEY: ${{secrets.ACA_DD_API_KEY}} | |
deploy-test: | |
uses: jeastham1993/PlantBasedPizza/.github/workflows/tf-deploy-base.yaml@azure | |
needs: build-and-push | |
with: | |
infrastructure-root-folder: "./infra/payments" | |
tf-state-backend-key: payments-test.tfstate | |
resource-group-name: plant-based-pizza-payments-test | |
env: payments-test | |
public-service-bus-namespace: plant-based-pizza-pub-payments-test | |
secrets: | |
AZURE_CLIENT_ID: ${{secrets.PAYMENTS_AZURE_CLIENT_ID}} | |
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} | |
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}} | |
DD_API_KEY: ${{secrets.ACA_DD_API_KEY}} | |
DB_CONNECTION_STRING: ${{secrets.DB_CONNECTION_STRING}} | |
MOMENTO_API_KEY: ${{secrets.MOMENTO_API_KEY}} | |
start-test-apps: | |
runs-on: ubuntu-latest | |
needs: deploy-test | |
defaults: | |
run: | |
working-directory: ./src/PlantBasedPizza.Payments | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9" | |
- name: Azure login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.PAYMENTS_AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Startup test container apps | |
env: | |
RUN_MODE: start | |
run: dotnet run --project tests/PlantBasedPizza.Payments.Management/PlantBasedPizza.Payments.Management.csproj | |
run-integration-tests: | |
runs-on: ubuntu-latest | |
needs: start-test-apps | |
defaults: | |
run: | |
working-directory: ./src/PlantBasedPizza.Payments | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9" | |
- name: Configure Datadog Test Visibility | |
uses: datadog/test-visibility-github-action@v2 | |
with: | |
languages: dotnet | |
api_key: ${{ secrets.ACA_DD_API_KEY }} | |
site: datadoghq.com # Change if your site is not US1 | |
- name: Azure login | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.PAYMENTS_AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Declare some variables | |
shell: bash | |
run: | | |
echo "IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
- name: Run integration tests | |
env: | |
TEST_HARNESS_ENDPOINT: ${{secrets.PAYMENT_TEST_HARNESS_ENDPOINT}} | |
run: make developer-test | |
- name: Stop test container apps | |
if: always() | |
env: | |
RUN_MODE: stop | |
run: dotnet run --project tests/PlantBasedPizza.Payments.Management/PlantBasedPizza.Payments.Management.csproj | |
deploy-dev: | |
uses: jeastham1993/PlantBasedPizza/.github/workflows/tf-deploy-base.yaml@azure | |
needs: run-integration-tests | |
with: | |
infrastructure-root-folder: "./infra/payments" | |
tf-state-backend-key: payments.tfstate | |
resource-group-name: plant-based-pizza-dev | |
env: dev | |
public-service-bus-namespace: plant-based-pizza-pub-dev | |
secrets: | |
AZURE_CLIENT_ID: ${{secrets.DEV_AZURE_CLIENT_ID}} | |
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}} | |
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}} | |
DD_API_KEY: ${{secrets.ACA_DD_API_KEY}} | |
DB_CONNECTION_STRING: ${{secrets.DB_CONNECTION_STRING}} | |
MOMENTO_API_KEY: ${{secrets.MOMENTO_API_KEY}} |