Skip to content

build(deps-dev): bump vite from 7.1.5 to 7.1.11 in /typescript (#184) #640

build(deps-dev): bump vite from 7.1.5 to 7.1.11 in /typescript (#184)

build(deps-dev): bump vite from 7.1.5 to 7.1.11 in /typescript (#184) #640

name: Build and validate generated code
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
actions: read
security-events: write
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
dotnet: ${{ steps.check.outputs.dotnet }}
typescript: ${{ steps.check.outputs.typescript }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check changed files
id: check
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "dotnet=true" >> $GITHUB_OUTPUT
echo "typescript=true" >> $GITHUB_OUTPUT
exit 0
fi
# Handle cases where github.base_ref is empty (direct push to a branch)
if [ -z "${{ github.base_ref }}" ]; then
# For pushes to main, compare with the previous commit
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "Direct push to main - comparing with previous commit"
CHANGED_FILES=$(git diff --name-only HEAD^..HEAD)
else
# For other branches, compare with main
echo "Direct push to branch - comparing with main"
git fetch origin main
CHANGED_FILES=$(git diff --name-only origin/main..HEAD)
fi
else
# Normal PR case - fetch the target branch and compare
echo "Pull request - comparing with target branch ${{ github.base_ref }}"
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD)
fi
echo "Changed Files:"
echo "$CHANGED_FILES"
if echo "$CHANGED_FILES" | grep -q "^dotnet/"; then
echo "dotnet=true" >> $GITHUB_OUTPUT
else
echo "dotnet=false" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -q "^typescript/"; then
echo "typescript=true" >> $GITHUB_OUTPUT
else
echo "typescript=false" >> $GITHUB_OUTPUT
fi
build-and-test-dotnet:
name: csharp
needs: check-changes
if: needs.check-changes.outputs.dotnet == 'true'
runs-on: ubuntu-latest
env:
solutionName: Microsoft.Agents.M365Copilot.sln
steps:
- uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 8.x
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
- name: Restore dependencies
run: dotnet restore ${{ env.solutionName }}
working-directory: dotnet
- name: Build
run: dotnet build ${{ env.solutionName }} --no-restore -c Debug /p:UseSharedCompilation=false
working-directory: dotnet
- name: Test
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Debug /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover
working-directory: dotnet
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
build-and-test-typescript:
name: typescript
needs: check-changes
if: needs.check-changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=9182"
environment:
name: build_test
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# Single version should work for compilation testing
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
working-directory: typescript
- run: npm run build
working-directory: typescript
- run: npm run test
working-directory: typescript
- name: Check for Secret availability
id: my-key-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.client_secret }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
- run: npm run test
if: steps.my-key-check.outputs.defined == 'true'
env:
TENANT_ID: ${{secrets.tenant_id}}
CLIENT_ID: ${{secrets.client_id}}
CLIENT_SECRET: ${{secrets.client_secret}}
USER_ID: ${{secrets.user_id}}
working-directory: typescript
check-build-matrix:
runs-on: ubuntu-latest
needs:
[
check-changes,
build-and-test-dotnet,
build-and-test-typescript,
]
if: always()
steps:
- name: Check build status
run: |
# Get the status of each job from the needs context
DOTNET_TRIGGERED=${{ needs.check-changes.outputs.dotnet == 'true' }}
TYPESCRIPT_TRIGGERED=${{ needs.check-changes.outputs.typescript == 'true' }}
DOTNET_STATUS="${{ needs.build-and-test-dotnet.result }}"
TYPESCRIPT_STATUS="${{ needs.build-and-test-typescript.result }}"
echo "Build Status Summary:"
echo "---------------------"
echo "Dotnet triggered: $DOTNET_TRIGGERED, Status: $DOTNET_STATUS"
echo "TypeScript triggered: $TYPESCRIPT_TRIGGERED, Status: $TYPESCRIPT_STATUS"
# Track if we should fail
SHOULD_FAIL=false
# If no builds were triggered, this is a success
if [[ "$DOTNET_TRIGGERED" == "false" && "$TYPESCRIPT_TRIGGERED" == "false" ]]; then
echo "✅ No language builds were triggered - changes were in other folders"
exit 0
fi
# Check each job that was triggered
if [[ "$DOTNET_TRIGGERED" == "true" && "$DOTNET_STATUS" != "success" && "$DOTNET_STATUS" != "skipped" ]]; then
echo "❌ Dotnet build failed or was cancelled"
SHOULD_FAIL=true
fi
if [[ "$TYPESCRIPT_TRIGGERED" == "true" && "$TYPESCRIPT_STATUS" != "success" && "$TYPESCRIPT_STATUS" != "skipped" ]]; then
echo "❌ TypeScript build failed or was cancelled"
SHOULD_FAIL=true
fi
# Final status
if [[ "$SHOULD_FAIL" == "true" ]]; then
echo "⛔ One or more triggered builds failed"
exit 1
else
echo "✅ All triggered builds completed successfully"
exit 0
fi