feat!: refine auto-detected project root behaviour #408
Workflow file for this run
This file contains hidden or 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
| # MIT License | |
| # | |
| # Copyright (c) 2026 Mickaël CANOUIL | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: | |
| # | |
| # The above copyright notice and this permission notice shall be included in all | |
| # copies or substantial portions of the Software. | |
| # | |
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| # SOFTWARE. | |
| name: Build & Test Extension | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - ready_for_review | |
| branches: | |
| - main | |
| paths: | |
| - "src/**" | |
| - "packages/**" | |
| - "package.json" | |
| - "package-lock.json" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.action }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| permissions: read-all | |
| jobs: | |
| build: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| node-version: [25.x] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # cache: "npm" | |
| - name: Install dependencies | |
| shell: bash | |
| run: npm ci | |
| - name: Lint schema package | |
| id: lint-schema | |
| shell: bash | |
| working-directory: packages/schema | |
| run: npm run lint | |
| - name: Test schema package | |
| id: test-schema | |
| shell: bash | |
| working-directory: packages/schema | |
| run: npm test | |
| - name: Lint snippets package | |
| id: lint-snippets | |
| shell: bash | |
| working-directory: packages/snippets | |
| run: npm run lint | |
| - name: Test snippets package | |
| id: test-snippets | |
| shell: bash | |
| working-directory: packages/snippets | |
| run: npm test | |
| - name: Lint core package | |
| id: lint-core | |
| shell: bash | |
| working-directory: packages/core | |
| run: npm run lint | |
| - name: Test core package | |
| id: test-core | |
| shell: bash | |
| working-directory: packages/core | |
| run: npm test | |
| - name: Compile extension | |
| id: webpack | |
| shell: bash | |
| run: npm run webpack | |
| - name: Run linter | |
| id: lint | |
| shell: bash | |
| run: npm run lint | |
| - name: Check formatting | |
| id: format | |
| shell: bash | |
| run: npm run format:check | |
| - name: Compile TypeScript | |
| id: test-compile | |
| shell: bash | |
| run: npm run test-compile | |
| - name: Run tests (Ubuntu) | |
| id: test-ubuntu | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| export DISPLAY=':99.0' | |
| /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | |
| npm test | |
| - name: Run tests (Windows/macOS) | |
| id: test-other | |
| if: runner.os != 'Linux' | |
| shell: bash | |
| run: npm test | |
| - name: Install Visual Studio Code Extension Manager | |
| shell: bash | |
| run: npm install -g @vscode/vsce | |
| - name: Build extension | |
| id: build-extension | |
| shell: bash | |
| run: vsce package --pre-release --out quarto-wizard.vsix | |
| - name: Upload VSIX as workflow artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: quarto-wizard-${{ github.sha }}-${{ matrix.os }}-${{ matrix.node-version }} | |
| path: quarto-wizard.vsix | |
| retention-days: 10 | |
| - name: Generate job result summary | |
| if: always() | |
| shell: bash | |
| run: | | |
| # Create a summary file for this specific job | |
| echo "OS: ${{ matrix.os }}" > job-summary.txt | |
| echo "Node: ${{ matrix.node-version }}" >> job-summary.txt | |
| # Determine test step outcome based on OS | |
| if [[ "${{ runner.os }}" == "Linux" ]]; then | |
| test_outcome="${{ steps.test-ubuntu.outcome }}" | |
| else | |
| test_outcome="${{ steps.test-other.outcome }}" | |
| fi | |
| # Use steps context to determine overall job status | |
| if [[ "${{ steps.lint-schema.outcome }}" == "failure" || "${{ steps.test-schema.outcome }}" == "failure" || "${{ steps.lint-snippets.outcome }}" == "failure" || "${{ steps.test-snippets.outcome }}" == "failure" || "${{ steps.lint-core.outcome }}" == "failure" || "${{ steps.test-core.outcome }}" == "failure" || "${{ steps.webpack.outcome }}" == "failure" || "${{ steps.lint.outcome }}" == "failure" || "${{ steps.format.outcome }}" == "failure" || "${{ steps.test-compile.outcome }}" == "failure" || "$test_outcome" == "failure" || "${{ steps.build-extension.outcome }}" == "failure" ]]; then | |
| echo "Status: failure" >> job-summary.txt | |
| elif [[ "${{ steps.lint-schema.outcome }}" == "cancelled" || "${{ steps.test-schema.outcome }}" == "cancelled" || "${{ steps.lint-snippets.outcome }}" == "cancelled" || "${{ steps.test-snippets.outcome }}" == "cancelled" || "${{ steps.lint-core.outcome }}" == "cancelled" || "${{ steps.test-core.outcome }}" == "cancelled" || "${{ steps.webpack.outcome }}" == "cancelled" || "${{ steps.lint.outcome }}" == "cancelled" || "${{ steps.format.outcome }}" == "cancelled" || "${{ steps.test-compile.outcome }}" == "cancelled" || "$test_outcome" == "cancelled" || "${{ steps.build-extension.outcome }}" == "cancelled" ]]; then | |
| echo "Status: cancelled" >> job-summary.txt | |
| else | |
| echo "Status: success" >> job-summary.txt | |
| fi | |
| echo "Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> job-summary.txt | |
| - name: Upload job summary | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: job-summary-${{ matrix.os }}-${{ matrix.node-version }} | |
| path: job-summary.txt | |
| retention-days: 1 | |
| summary: | |
| if: github.event.pull_request.draft == false | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all job summaries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: job-summary-* | |
| path: job-summaries | |
| - name: Generate consolidated summary | |
| shell: bash | |
| run: | | |
| echo "# 🚀 Quarto Wizard Build & Test Results" >> ${GITHUB_STEP_SUMMARY} | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| # Add Pull Request link if triggered by PR event | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "**🔗 Pull Request**: [#${{ github.event.number }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.pull_request.title }}" >> ${GITHUB_STEP_SUMMARY} | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| fi | |
| echo "## 📊 Build Matrix Results" >> ${GITHUB_STEP_SUMMARY} | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| # Create table header | |
| echo "| Operating System | Node.js Version | Status | Timestamp |" >> ${GITHUB_STEP_SUMMARY} | |
| echo "|------------------|-----------------|--------|-----------|" >> ${GITHUB_STEP_SUMMARY} | |
| total_jobs=0 | |
| successful_jobs=0 | |
| failed_jobs=0 | |
| cancelled_jobs=0 | |
| # Find all job-summary.txt files in job-summaries subfolders | |
| find job-summaries -type f -name "job-summary.txt" | while read summary_file; do | |
| if [[ -f "${summary_file}" ]]; then | |
| total_jobs=$((total_jobs + 1)) | |
| os=$(grep "OS:" "${summary_file}" | cut -d' ' -f2- || echo "Unknown") | |
| node=$(grep "Node:" "${summary_file}" | cut -d' ' -f2- || echo "Unknown") | |
| status=$(grep "Status:" "${summary_file}" | cut -d' ' -f2- || echo "unknown") | |
| timestamp=$(grep "Timestamp:" "${summary_file}" | cut -d' ' -f2- || echo "Unknown") | |
| case "${status}" in | |
| "success") | |
| status_emoji="✅" | |
| successful_jobs=$((successful_jobs + 1)) | |
| ;; | |
| "failure") | |
| status_emoji="❌" | |
| failed_jobs=$((failed_jobs + 1)) | |
| ;; | |
| "cancelled") | |
| status_emoji="🟡" | |
| cancelled_jobs=$((cancelled_jobs + 1)) | |
| ;; | |
| *) | |
| status_emoji="⚠️" | |
| ;; | |
| esac | |
| echo "| ${os} | ${node} | ${status_emoji} ${status} | ${timestamp} |" >> ${GITHUB_STEP_SUMMARY} | |
| fi | |
| done | |
| # Calculate totals using GitHub API if job summaries are not available | |
| if [[ ! -d "job-summaries" ]] || [[ $(find job-summaries -type f -name "job-summary.txt" | wc -l) -eq 0 ]]; then | |
| echo "| Build Matrix | All Versions | ${{ needs.build.result == 'success' && '✅ success' || needs.build.result == 'failure' && '❌ failure' || '🟡 cancelled' }} | $(date -u +"%Y-%m-%d %H:%M:%S UTC") |" >> ${GITHUB_STEP_SUMMARY} | |
| total_jobs=1 | |
| case "${{ needs.build.result }}" in | |
| "success") successful_jobs=1 ;; | |
| "failure") failed_jobs=1 ;; | |
| "cancelled") cancelled_jobs=1 ;; | |
| esac | |
| fi | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| echo "## 📈 Summary Statistics" >> ${GITHUB_STEP_SUMMARY} | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| # Calculate totals from the files if they exist | |
| if [[ -d "job-summaries" ]]; then | |
| total_jobs=$(find job-summaries -type f -name "job-summary.txt" | wc -l) | |
| successful_jobs=$(find job-summaries -type f -name "job-summary.txt" -exec grep -l "Status: success" {} \; | wc -l) | |
| failed_jobs=$(find job-summaries -type f -name "job-summary.txt" -exec grep -l "Status: failure" {} \; | wc -l) | |
| cancelled_jobs=$(find job-summaries -type f -name "job-summary.txt" -exec grep -l "Status: cancelled" {} \; | wc -l) | |
| fi | |
| success_rate=0 | |
| if [[ ${total_jobs} -gt 0 ]]; then | |
| success_rate=$(( successful_jobs * 100 / total_jobs )) | |
| fi | |
| echo "- **Total Jobs**: ${total_jobs}" >> ${GITHUB_STEP_SUMMARY} | |
| echo "- **Successful**: ${successful_jobs} ✅" >> ${GITHUB_STEP_SUMMARY} | |
| echo "- **Failed**: ${failed_jobs} ❌" >> ${GITHUB_STEP_SUMMARY} | |
| if [[ ${cancelled_jobs} -gt 0 ]]; then | |
| echo "- **Cancelled**: ${cancelled_jobs} 🟡" >> ${GITHUB_STEP_SUMMARY} | |
| fi | |
| echo "- **Success Rate**: ${success_rate}%" >> ${GITHUB_STEP_SUMMARY} | |
| echo "" >> ${GITHUB_STEP_SUMMARY} | |
| # Overall workflow status | |
| if [[ ${failed_jobs} -eq 0 && ${cancelled_jobs} -eq 0 ]]; then | |
| echo "## 🎉 Overall Result: SUCCESS" >> ${GITHUB_STEP_SUMMARY} | |
| echo "All build matrix jobs completed successfully!" >> ${GITHUB_STEP_SUMMARY} | |
| elif [[ ${failed_jobs} -gt 0 ]]; then | |
| echo "## ⚠️ Overall Result: FAILURE" >> ${GITHUB_STEP_SUMMARY} | |
| echo "${failed_jobs} out of ${total_jobs} jobs failed. Please check the individual job logs for details." >> ${GITHUB_STEP_SUMMARY} | |
| else | |
| echo "## 🟡 Overall Result: CANCELLED" >> ${GITHUB_STEP_SUMMARY} | |
| echo "Some jobs were cancelled during execution." >> ${GITHUB_STEP_SUMMARY} | |
| fi |