diff --git a/.github/workflows/infra-validation.yaml b/.github/workflows/infra-validation.yaml deleted file mode 100644 index 8dc77f5..0000000 --- a/.github/workflows/infra-validation.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Validate AZD template -on: - push: - branches: [ main ] - paths: - - "infra/**" - pull_request: - branches: [ main ] - paths: - - "infra/**" - -jobs: - build: - - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build Bicep for linting - uses: azure/CLI@v1 - with: - inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout - - - name: Run Microsoft Security DevOps Analysis - uses: microsoft/security-devops-action@preview - id: msdo - continue-on-error: true - with: - tools: templateanalyzer - - - name: Upload alerts to Security tab - uses: github/codeql-action/upload-sarif@v2 - if: github.repository == 'Azure-Samples/azure-search-openai-demo' - with: - sarif_file: ${{ steps.msdo.outputs.sarifFile }} diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml new file mode 100644 index 0000000..44dc9ab --- /dev/null +++ b/.github/workflows/stale-bot.yml @@ -0,0 +1,19 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v8 + with: + stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.' + stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed.' + close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.' + close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' + days-before-issue-stale: 60 + days-before-pr-stale: 60 + days-before-issue-close: -1 + days-before-pr-close: -1 diff --git a/.github/workflows/template-validation.yaml b/.github/workflows/template-validation.yaml new file mode 100644 index 0000000..476746a --- /dev/null +++ b/.github/workflows/template-validation.yaml @@ -0,0 +1,81 @@ +name: Validate AZD template +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 0 * * *' # Run at midnight every day + +jobs: + infra: + name: "Infra Biceps Validation" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build Bicep for linting + uses: azure/CLI@v1 + with: + inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout + + - name: Run Microsoft Security DevOps Analysis + uses: microsoft/security-devops-action@preview + id: msdo + continue-on-error: true + with: + tools: templateanalyzer + + - name: Upload alerts to Security tab + uses: github/codeql-action/upload-sarif@v2 + if: github.repository == 'Azure-Samples/azure-search-openai-demo' + with: + sarif_file: ${{ steps.msdo.outputs.sarifFile }} + + frontend: + name: "Front-end validation" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build React Frontend + run: | + echo "Building front-end and merge into Spring Boot static folder. Environment [${{ steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT }}]" + cd ./app/frontend + npm install + npm run build + + backend: + name: "Backend validation" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Java version + uses: actions/setup-java@v2 + with: + distribution: 'microsoft' + java-version: '17' + cache: 'maven' + + - name: Set environment for branch + id: set-deploy-env + run: | + if [[ $GITHUB_REF_NAME == 'refs/heads/main' ]]; then + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" + elif [[ $GITHUB_REF_NAME == 'refs/heads/develop' ]]; then + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" + elif [[ $GITHUB_REF_NAME == 'refs/heads/release' ]]; then + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" + else + echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT" + fi + + - name: Build Spring Boot App + run: | + echo "Building Spring Boot app. Environment [${{ steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT }}]" + cd ./app/backend + ./mvnw verify