-
Notifications
You must be signed in to change notification settings - Fork 4
295 lines (256 loc) · 10.6 KB
/
release.yml
File metadata and controls
295 lines (256 loc) · 10.6 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-and-release:
name: Build ${{ matrix.target }}
permissions:
contents: read
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- target: x86_64-unknown-linux-gnu
runner: self-hosted
asset_name: x86_64-unknown-linux-gnu
# # Linux ARM64 (aarch64)
# - target: aarch64-unknown-linux-gnu
# runner: ubuntu-24.04-arm
# asset_name: aarch64-unknown-linux-gnu
#
# # macOS x86_64
# - target: x86_64-apple-darwin
# runner: macos-13
# asset_name: x86_64-apple-darwin
#
# # macOS ARM64
# - target: aarch64-apple-darwin
# runner: macos-latest
# asset_name: aarch64-apple-darwin
# Windows x86_64
- target: x86_64-pc-windows-msvc
runner: windows-latest
asset_name: x86_64-windows
binary_ext: .exe
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history to verify tag is from "main" branch
# - name: Verify tag is from main branch
# shell: bash
# run: |
# # Get the commit SHA that the tag points to
# TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }})
#
# # Check if this commit exists on main branch
# git fetch origin main
# if ! git merge-base --is-ancestor $TAG_COMMIT origin/main; then
# echo "Error: Tag must be created from main branch!"
# echo "This tag points to commit $TAG_COMMIT which is not on main branch."
# exit 1
# fi
# echo "Tag is from main branch (commit: $TAG_COMMIT)"
#
# # Make sure that Cargo.toml version for each tool is the same as the tag
# - name: Verify version consistency
# shell: bash
# run: |
# # Extract version from tag
# TAG_VERSION="${GITHUB_REF#refs/tags/v}"
#
# # Check each tool's Cargo.toml version
# for tool in move-mutation-test move-mutator move-spec-test; do
# CARGO_VERSION=$(grep "^version" $tool/Cargo.toml | head -1 | cut -d'"' -f2)
# if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
# echo "Error: Version mismatch for $tool!"
# echo " Tag version: $TAG_VERSION"
# echo " Cargo.toml version: $CARGO_VERSION"
# exit 1
# fi
# echo "$tool version matches: $CARGO_VERSION"
# done
- name: Enable long paths on Windows
if: runner.os == 'Windows'
run: |
git config --system core.longpaths true
reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
shell: pwsh
- name: Install required deps
if: runner.os == 'Linux'
run: sudo apt-get install libssl-dev pkg-config libudev-dev libdw-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Aptos CLI
shell: bash
run: |
if [ "${{ runner.os }}" = "macOS" ]; then
echo "Installing Aptos CLI via Homebrew..."
brew install aptos
elif [ "${{ runner.os }}" = "Windows" ]; then
echo "Installing Aptos CLI via Chocolatey..."
choco install aptos -y
else
echo "Installing Aptos CLI via installer script..."
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
source ~/.profile
APTOS_PATH=$(dirname $(which aptos))
echo "$APTOS_PATH" >> $GITHUB_PATH
fi
aptos --version
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Build all tools
shell: bash
run: |
cargo build --release --bin move-mutation-test
cargo build --release --bin move-mutator
cargo build --release --bin move-spec-test
- name: Basic smoke test
shell: bash
run: |
./target/release/move-mutation-test${{ matrix.binary_ext }} --version
./target/release/move-mutator${{ matrix.binary_ext }} --version
./target/release/move-spec-test${{ matrix.binary_ext }} --version
- name: Test move-mutation-test tool on simple_move_2_features (Linux, Mac, Windows)
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
choco install unxutils strawberryperl
fi
echo "Testing mutation tools on simple_move_2_features project..."
cd move-mutator/tests/move-assets/simple_move_2_features
echo "Generating coverage data with aptos move test..."
aptos move test --coverage
echo "Running move-mutation-test with coverage..."
if [ "${{ runner.os }}" = "Windows" ]; then
../../../../target/release/move-mutation-test.exe run --coverage --output report-mutation-generated.txt
else
../../../../target/release/move-mutation-test run --coverage --output report-mutation-generated.txt
fi
if [ "${{ runner.os }}" = "Windows" ]; then
# HACK: Normalize Windows path. This only works because we test a single Move project
sed -i 's/"sources\\\\Operators.move"/"sources\/Operators.move"/g' report-mutation-generated.txt
fi
# Remove trailing newlines from both files
perl -pi -e 'chomp if eof' report-mutation-generated.txt
perl -pi -e 'chomp if eof' report.txt.mutation-exp
# Get all lines except last 3 (excluding package_dir)
LINES_GEN=$(wc -l < report-mutation-generated.txt)
LINES_EXP=$(wc -l < report.txt.mutation-exp)
KEEP_GEN=$((LINES_GEN - 3))
KEEP_EXP=$((LINES_EXP - 3))
head -n "$KEEP_GEN" report-mutation-generated.txt > report-mutation-gen-trimmed.txt
head -n "$KEEP_EXP" report.txt.mutation-exp > report-mutation-exp-trimmed.txt
if diff -B report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt > /dev/null 2>&1; then
echo "move-mutation-test report matches expected"
rm -f report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt
else
echo "move-mutation-test report differs from expected"
echo "=== Differences ==="
diff -B report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt || true
rm -f report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt
exit 1
fi
# Determine version for asset naming
- name: Get version
id: version
shell: bash
run: |
# Extract version from tag (remove 'v' prefix)
VERSION="${GITHUB_REF#refs/tags/v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Package all tools for release
shell: bash
run: |
mkdir -p package
cp target/release/move-mutation-test${{ matrix.binary_ext }} package/move-mutation-test${{ matrix.binary_ext }}
cp target/release/move-mutator${{ matrix.binary_ext }} package/move-mutator${{ matrix.binary_ext }}
cp target/release/move-spec-test${{ matrix.binary_ext }} package/move-spec-test${{ matrix.binary_ext }}
cd package
if [ "${{ runner.os }}" = "Windows" ]; then
7z a -tzip ../mutation-tools-${{ matrix.asset_name }}.zip *
else
zip -r ../mutation-tools-${{ matrix.asset_name }}.zip *
fi
cd ..
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: |
mutation-tools-${{ matrix.asset_name }}.zip
create-release:
name: Create GitHub Release
runs-on: self-hosted
needs: build-and-release
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine version
id: version
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
find artifacts -name "*.zip" | while read file; do
cp "$file" release-assets/
done
ls -lh release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Move Mutation Tools v${{ steps.version.outputs.version }}
body: |
## Installation Options
### Via Aptos CLI (Recommended for most users)
```bash
aptos update move-mutation-test
```
This installs `move-mutation-test` which is the main tool most users need.
### Direct Download (All tools)
Download the appropriate archive for your platform below. Each archive contains:
- `move-mutation-test` - Tests the quality of your unit test suite
- `move-mutator` - Core mutation engine for advanced users
- `move-spec-test` - Tests the quality of your formal specifications
## Platform Support
| Platform | Architecture | File |
|----------|--------------|------|
| Linux | x86_64 | `mutation-tools-x86_64-unknown-linux-gnu.zip` |
| Linux | ARM64/aarch64 | `mutation-tools-aarch64-unknown-linux-gnu.zip` |
| macOS | x86_64 (Intel) | `mutation-tools-x86_64-apple-darwin.zip` |
| macOS | ARM64 (Apple Silicon) | `mutation-tools-aarch64-apple-darwin.zip` |
| Windows | x86_64 | `mutation-tools-x86_64-windows.zip` |
## Documentation
For usage instructions and examples, visit: https://github.com/eigerco/move-mutation-tools
draft: true
prerelease: false
files: release-assets/*
fail_on_unmatched_files: true
generate_release_notes: true