|
| 1 | +name: Validate AZD template |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ main ] |
| 5 | + pull_request: |
| 6 | + branches: [ main ] |
| 7 | + schedule: |
| 8 | + - cron: '0 0 * * *' # Run at midnight every day |
| 9 | + |
| 10 | +jobs: |
| 11 | + infra: |
| 12 | + name: "Infra Biceps Validation" |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - name: Build Bicep for linting |
| 19 | + uses: azure/CLI@v1 |
| 20 | + with: |
| 21 | + inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout |
| 22 | + |
| 23 | + - name: Run Microsoft Security DevOps Analysis |
| 24 | + uses: microsoft/security-devops-action@preview |
| 25 | + id: msdo |
| 26 | + continue-on-error: true |
| 27 | + with: |
| 28 | + tools: templateanalyzer |
| 29 | + |
| 30 | + - name: Upload alerts to Security tab |
| 31 | + uses: github/codeql-action/upload-sarif@v2 |
| 32 | + if: github.repository == 'Azure-Samples/azure-search-openai-demo' |
| 33 | + with: |
| 34 | + sarif_file: ${{ steps.msdo.outputs.sarifFile }} |
| 35 | + |
| 36 | + frontend: |
| 37 | + name: "Front-end validation" |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v3 |
| 42 | + |
| 43 | + - name: Build React Frontend |
| 44 | + run: | |
| 45 | + echo "Building front-end and merge into Spring Boot static folder. Environment [${{ steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT }}]" |
| 46 | + cd ./app/frontend |
| 47 | + npm install |
| 48 | + npm run build |
| 49 | +
|
| 50 | + backend: |
| 51 | + name: "Backend validation" |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v3 |
| 56 | + |
| 57 | + - name: Set up Java version |
| 58 | + uses: actions/setup-java@v2 |
| 59 | + with: |
| 60 | + distribution: 'microsoft' |
| 61 | + java-version: '17' |
| 62 | + cache: 'maven' |
| 63 | + |
| 64 | + - name: Set environment for branch |
| 65 | + id: set-deploy-env |
| 66 | + run: | |
| 67 | + if [[ $GITHUB_REF_NAME == 'refs/heads/main' ]]; then |
| 68 | + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" |
| 69 | + elif [[ $GITHUB_REF_NAME == 'refs/heads/develop' ]]; then |
| 70 | + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" |
| 71 | + elif [[ $GITHUB_REF_NAME == 'refs/heads/release' ]]; then |
| 72 | + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" |
| 73 | + else |
| 74 | + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" |
| 75 | + fi |
| 76 | +
|
| 77 | + - name: Build Spring Boot App |
| 78 | + run: | |
| 79 | + echo "Building Spring Boot app. Environment [${{ steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT }}]" |
| 80 | + cd ./app/backend |
| 81 | + ./mvnw verify |
0 commit comments