feat: test against wit-bingen tests #192
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
| name: Windows | |
| on: | |
| push: | |
| branches: | |
| - trunk | |
| - main | |
| pull_request: | |
| branches: | |
| - trunk | |
| - main | |
| workflow_dispatch: | |
| env: | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: "windows-2022" | |
| config: vcpkg-VS-17 | |
| build: VS-17-Debug | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Cache Cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache vcpkg registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| build/vcpkg_installed/ | |
| build/vcpkg_packages/ | |
| key: ${{ runner.os }}-vcpkg-${{ hashFiles('./vcpkg*.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vcpkg- | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Install rust dependencies | |
| run: | | |
| cargo install wasm-tools wit-bindgen-cli || true | |
| - name: configure | |
| run: | | |
| cmake --preset ${{ matrix.config }} | |
| - name: build | |
| run: | | |
| cmake --build --preset ${{ matrix.build }} | |
| - name: test | |
| working-directory: build | |
| run: | | |
| ctest -C Debug -VV -E "wit-stub-generation-test" | |
| - name: test-stubs-full (allowed to fail) | |
| working-directory: build | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| echo "Running wit-stub-generation-test (failures expected and will be reported)..." | |
| ctest -C Debug -VV -R "wit-stub-generation-test" > test_output.txt 2>&1 || true | |
| cat test_output.txt | |
| ../.github/scripts/summarize-test-failures.sh test_output.txt test_summary.md | |
| - name: Comment PR with test summary | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const summary = fs.readFileSync('build/test_summary.md', 'utf8'); | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('wit-stub-generation-test Results') | |
| ); | |
| const commentBody = `### Windows Test Results\n\n${summary}\n\n---\n*Updated: ${new Date().toISOString()}*`; | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: commentBody | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: commentBody | |
| }); | |
| } | |
| - name: Upload error logs | |
| if: ${{ failure() || cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os }}-logs | |
| path: ./**/*.log |