-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (133 loc) · 4.39 KB
/
ubuntu.yml
File metadata and controls
156 lines (133 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Ubuntu
on:
push:
branches:
- trunk
- main
pull_request:
branches:
- trunk
- main
workflow_dispatch:
env:
CTEST_OUTPUT_ON_FAILURE: 1
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
permissions:
contents: read
pull-requests: write
issues: write
jobs:
build:
strategy:
matrix:
include:
- os: "ubuntu-24.04"
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
if: always()
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: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
autoconf \
autoconf-archive \
automake \
build-essential \
ninja-build
- name: Install rust dependencies
run: |
cargo install wasm-tools wit-bindgen-cli || true
- name: configure
run: |
cmake --preset linux-ninja-Debug
- name: build
run: |
cmake --build --preset linux-ninja-Debug
- name: test
working-directory: build
run: |
ctest -VV -E "wit-stub-generation-test"
- name: test-stubs-full (allowed to fail)
working-directory: build
continue-on-error: true
run: |
echo "Running wit-stub-generation-test (failures expected and will be reported)..."
ctest -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 path = require('path');
// Check if summary file exists
const summaryPath = path.join('build', 'test_summary.md');
if (!fs.existsSync(summaryPath)) {
console.log('Test summary file not found, skipping PR comment');
return;
}
const summary = fs.readFileSync(summaryPath, '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 = `### Ubuntu 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 coverage reports to Codecov
uses: codecov/codecov-action@v5.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-logs
path: ./**/*.log