Skip to content

Commit ca94e09

Browse files
ctoyanjoske
andauthored
Milestone 1: Language compatibility update & automation (#102)
* feat: bump rust and aptos versions (#98) * sets all aptos-core Rust dependencies to `aptos-release-v1.35` branch * fixes compilation errors related to those version updates * creates new fixtures for the integration tests (re-generated report.txt files - same content of the report.txt, but different mutant order) * removes x25519-dalek patch as it's not used in the crate graph * replaces deprecated tempdir into_path() with keep() * feat: add a progressbar to mutant testing (#100) * chore: add test for Move v2.2 new function values (#101) * chore: pin aptos-stdlib version in move-assets to v1.35 (#108) * feat: automated CI releases (#104) * remove lld compiler flag and bump rust to 1.90 * remove `force-frame-pointers` and `force-unwind-tables` * chore: update release docs (#105) * fix: clippy errors and failing CI (#109) * fix clippy errors and test CI * prepend RUSTFLAGS="--cfg tokio_unstable" for all cargo tasks * fix: fix failing CI matrix build * chore: add more tests for Move 2 features (#111) --------- Co-authored-by: Jos Dehaes <[email protected]>
1 parent 4108fb7 commit ca94e09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5117
-1878
lines changed

.cargo/config.toml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,29 @@ xclippy = [
1515
x = "run --package aptos-cargo-cli --bin aptos-cargo-cli --"
1616

1717
[build]
18-
rustflags = ["--cfg", "tokio_unstable", "-C", "force-frame-pointers=yes", "-C", "force-unwind-tables=yes"]
18+
rustflags = ["--cfg", "tokio_unstable"]
1919

2020
[target.x86_64-unknown-linux-gnu]
21-
rustflags = ["--cfg", "tokio_unstable", "-C", "link-arg=-fuse-ld=lld", "-C", "force-frame-pointers=yes", "-C", "force-unwind-tables=yes", "-C", "target-feature=+sse4.2"]
21+
rustflags = ["--cfg", "tokio_unstable", "-C", "target-feature=+sse4.2"]
2222

2323
# 64 bit MSVC
2424
[target.x86_64-pc-windows-msvc]
2525
rustflags = [
2626
"--cfg",
2727
"tokio_unstable",
2828
"-C",
29-
"force-frame-pointers=yes",
29+
"link-arg=/STACK:8000000", # Set stack to 8 MB
3030
"-C",
31-
"force-unwind-tables=yes",
31+
"link-arg=advapi32.lib", # Required for libgit2-sys (registry and crypto functions)
3232
"-C",
33-
"link-arg=/STACK:8000000" # Set stack to 8 MB
33+
"link-arg=userenv.lib" # Required for libgit2-sys (token functions)
3434
]
35+
36+
# macOS x86_64
37+
[target.x86_64-apple-darwin]
38+
rustflags = ["--cfg", "tokio_unstable"]
39+
40+
# macOS ARM64
41+
[target.aarch64-apple-darwin]
42+
rustflags = ["--cfg", "tokio_unstable"]
43+

.github/workflows/check-and-lint.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ jobs:
3434
run: sudo apt-get install libudev-dev libdw-dev lld
3535

3636
- name: Setup Rust toolchain
37-
uses: actions-rs/toolchain@v1
37+
uses: actions-rust-lang/setup-rust-toolchain@v1
3838
with:
39-
profile: default
40-
toolchain: stable
39+
components: rustfmt
4140

42-
- name: Run check
43-
run: cargo check --all-targets
44-
45-
- name: Run fmt
46-
run: cargo fmt --all -- --check
41+
- name: Rustfmt Check
42+
uses: actions-rust-lang/rustfmt@v1
4743

4844
- name: Run clippy
49-
run: cargo clippy --all-targets -- -D warnings
45+
run: RUSTFLAGS="--cfg tokio_unstable" cargo clippy --all-targets -- -D warnings
46+
47+
- name: Run check
48+
run: RUSTFLAGS="--cfg tokio_unstable" cargo check --all-targets

.github/workflows/release.yml

Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUST_BACKTRACE: 1
11+
12+
jobs:
13+
build-and-release:
14+
name: Build ${{ matrix.target }}
15+
permissions:
16+
contents: read
17+
runs-on: ${{ matrix.runner }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
# Linux x86_64
23+
- target: x86_64-unknown-linux-gnu
24+
runner: self-hosted
25+
asset_name: x86_64-unknown-linux-gnu
26+
27+
# Linux ARM64 (aarch64)
28+
- target: aarch64-unknown-linux-gnu
29+
runner: ubuntu-24.04-arm
30+
asset_name: aarch64-unknown-linux-gnu
31+
32+
# macOS x86_64
33+
- target: x86_64-apple-darwin
34+
runner: macos-13
35+
asset_name: x86_64-apple-darwin
36+
37+
# macOS ARM64
38+
- target: aarch64-apple-darwin
39+
runner: macos-latest
40+
asset_name: aarch64-apple-darwin
41+
42+
# Windows x86_64
43+
- target: x86_64-pc-windows-msvc
44+
runner: windows-latest
45+
asset_name: x86_64-windows
46+
binary_ext: .exe
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0 # Need full history to verify tag is from "main" branch
53+
54+
# - name: Verify tag is from main branch
55+
# shell: bash
56+
# run: |
57+
# # Get the commit SHA that the tag points to
58+
# TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }})
59+
#
60+
# # Check if this commit exists on main branch
61+
# git fetch origin main
62+
# if ! git merge-base --is-ancestor $TAG_COMMIT origin/main; then
63+
# echo "Error: Tag must be created from main branch!"
64+
# echo "This tag points to commit $TAG_COMMIT which is not on main branch."
65+
# exit 1
66+
# fi
67+
# echo "Tag is from main branch (commit: $TAG_COMMIT)"
68+
#
69+
# # Make sure that Cargo.toml version for each tool is the same as the tag
70+
# - name: Verify version consistency
71+
# shell: bash
72+
# run: |
73+
# # Extract version from tag
74+
# TAG_VERSION="${GITHUB_REF#refs/tags/v}"
75+
#
76+
# # Check each tool's Cargo.toml version
77+
# for tool in move-mutation-test move-mutator move-spec-test; do
78+
# CARGO_VERSION=$(grep "^version" $tool/Cargo.toml | head -1 | cut -d'"' -f2)
79+
# if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
80+
# echo "Error: Version mismatch for $tool!"
81+
# echo " Tag version: $TAG_VERSION"
82+
# echo " Cargo.toml version: $CARGO_VERSION"
83+
# exit 1
84+
# fi
85+
# echo "$tool version matches: $CARGO_VERSION"
86+
# done
87+
88+
- name: Enable long paths on Windows
89+
if: runner.os == 'Windows'
90+
run: |
91+
git config --system core.longpaths true
92+
reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
93+
shell: pwsh
94+
95+
- name: Install required deps
96+
if: runner.os == 'Linux'
97+
run: sudo apt-get install libssl-dev pkg-config libudev-dev libdw-dev
98+
99+
- name: Install Rust toolchain
100+
uses: dtolnay/rust-toolchain@stable
101+
102+
- name: Install Aptos CLI
103+
shell: bash
104+
run: |
105+
if [ "${{ runner.os }}" = "macOS" ]; then
106+
echo "Installing Aptos CLI via Homebrew..."
107+
brew install aptos
108+
elif [ "${{ runner.os }}" = "Windows" ]; then
109+
echo "Installing Aptos CLI via Chocolatey..."
110+
choco install aptos -y
111+
else
112+
echo "Installing Aptos CLI via installer script..."
113+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
114+
source ~/.profile
115+
APTOS_PATH=$(dirname $(which aptos))
116+
echo "$APTOS_PATH" >> $GITHUB_PATH
117+
fi
118+
aptos --version
119+
120+
- name: Cache Cargo
121+
uses: actions/cache@v4
122+
with:
123+
path: |
124+
~/.cargo/bin/
125+
~/.cargo/registry/index/
126+
~/.cargo/registry/cache/
127+
~/.cargo/git/db/
128+
target/
129+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
130+
131+
- name: Build all tools
132+
shell: bash
133+
run: |
134+
cargo build --release --bin move-mutation-test
135+
cargo build --release --bin move-mutator
136+
cargo build --release --bin move-spec-test
137+
138+
- name: Basic smoke test
139+
shell: bash
140+
run: |
141+
./target/release/move-mutation-test${{ matrix.binary_ext }} --version
142+
./target/release/move-mutator${{ matrix.binary_ext }} --version
143+
./target/release/move-spec-test${{ matrix.binary_ext }} --version
144+
145+
- name: Test move-mutation-test tool on simple_move_2_features (Linux, Mac, Windows)
146+
shell: bash
147+
run: |
148+
if [ "${{ runner.os }}" = "Windows" ]; then
149+
choco install unxutils strawberryperl
150+
fi
151+
152+
echo "Testing mutation tools on simple_move_2_features project..."
153+
cd move-mutator/tests/move-assets/simple_move_2_features
154+
155+
echo "Generating coverage data with aptos move test..."
156+
aptos move test --coverage
157+
158+
echo "Running move-mutation-test with coverage..."
159+
if [ "${{ runner.os }}" = "Windows" ]; then
160+
../../../../target/release/move-mutation-test.exe run --coverage --output report-mutation-generated.txt
161+
else
162+
../../../../target/release/move-mutation-test run --coverage --output report-mutation-generated.txt
163+
fi
164+
165+
if [ "${{ runner.os }}" = "Windows" ]; then
166+
# HACK: Normalize Windows path. This only works because we test a single Move project
167+
sed -i 's/"sources\\\\Operators.move"/"sources\/Operators.move"/g' report-mutation-generated.txt
168+
fi
169+
170+
# Remove trailing newlines from both files
171+
perl -pi -e 'chomp if eof' report-mutation-generated.txt
172+
perl -pi -e 'chomp if eof' report.txt.mutation-exp
173+
174+
# Get all lines except last 3 (excluding package_dir)
175+
LINES_GEN=$(wc -l < report-mutation-generated.txt)
176+
LINES_EXP=$(wc -l < report.txt.mutation-exp)
177+
KEEP_GEN=$((LINES_GEN - 3))
178+
KEEP_EXP=$((LINES_EXP - 3))
179+
180+
head -n "$KEEP_GEN" report-mutation-generated.txt > report-mutation-gen-trimmed.txt
181+
head -n "$KEEP_EXP" report.txt.mutation-exp > report-mutation-exp-trimmed.txt
182+
183+
if diff -B report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt > /dev/null 2>&1; then
184+
echo "move-mutation-test report matches expected"
185+
rm -f report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt
186+
else
187+
echo "move-mutation-test report differs from expected"
188+
echo "=== Differences ==="
189+
diff -B report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt || true
190+
rm -f report-mutation-gen-trimmed.txt report-mutation-exp-trimmed.txt
191+
exit 1
192+
fi
193+
194+
# Determine version for asset naming
195+
- name: Get version
196+
id: version
197+
shell: bash
198+
run: |
199+
# Extract version from tag (remove 'v' prefix)
200+
VERSION="${GITHUB_REF#refs/tags/v}"
201+
echo "version=$VERSION" >> $GITHUB_OUTPUT
202+
203+
- name: Package all tools for release
204+
shell: bash
205+
run: |
206+
mkdir -p package
207+
208+
cp target/release/move-mutation-test${{ matrix.binary_ext }} package/move-mutation-test${{ matrix.binary_ext }}
209+
cp target/release/move-mutator${{ matrix.binary_ext }} package/move-mutator${{ matrix.binary_ext }}
210+
cp target/release/move-spec-test${{ matrix.binary_ext }} package/move-spec-test${{ matrix.binary_ext }}
211+
212+
cd package
213+
if [ "${{ runner.os }}" = "Windows" ]; then
214+
7z a -tzip ../mutation-tools-${{ matrix.asset_name }}.zip *
215+
else
216+
zip -r ../mutation-tools-${{ matrix.asset_name }}.zip *
217+
fi
218+
cd ..
219+
220+
- name: Upload release artifacts
221+
uses: actions/upload-artifact@v4
222+
with:
223+
name: release-${{ matrix.target }}
224+
path: |
225+
mutation-tools-${{ matrix.asset_name }}.zip
226+
227+
create-release:
228+
name: Create GitHub Release
229+
runs-on: self-hosted
230+
needs: build-and-release
231+
permissions:
232+
contents: write
233+
234+
steps:
235+
- name: Checkout code
236+
uses: actions/checkout@v4
237+
238+
- name: Determine version
239+
id: version
240+
run: |
241+
TAG="${GITHUB_REF#refs/tags/}"
242+
VERSION="${TAG#v}"
243+
echo "version=$VERSION" >> $GITHUB_OUTPUT
244+
echo "tag=$TAG" >> $GITHUB_OUTPUT
245+
246+
- name: Download all artifacts
247+
uses: actions/download-artifact@v4
248+
with:
249+
path: artifacts
250+
251+
- name: Prepare release assets
252+
run: |
253+
mkdir -p release-assets
254+
find artifacts -name "*.zip" | while read file; do
255+
cp "$file" release-assets/
256+
done
257+
ls -lh release-assets/
258+
259+
- name: Create GitHub Release
260+
uses: softprops/action-gh-release@v2
261+
with:
262+
tag_name: ${{ steps.version.outputs.tag }}
263+
name: Move Mutation Tools v${{ steps.version.outputs.version }}
264+
body: |
265+
## Installation Options
266+
267+
### Via Aptos CLI (Recommended for most users)
268+
```bash
269+
aptos update move-mutation-test
270+
```
271+
This installs `move-mutation-test` which is the main tool most users need.
272+
273+
### Direct Download (All tools)
274+
Download the appropriate archive for your platform below. Each archive contains:
275+
- `move-mutation-test` - Tests the quality of your unit test suite
276+
- `move-mutator` - Core mutation engine for advanced users
277+
- `move-spec-test` - Tests the quality of your formal specifications
278+
279+
## Platform Support
280+
281+
| Platform | Architecture | File |
282+
|----------|--------------|------|
283+
| Linux | x86_64 | `mutation-tools-x86_64-unknown-linux-gnu.zip` |
284+
| Linux | ARM64/aarch64 | `mutation-tools-aarch64-unknown-linux-gnu.zip` |
285+
| macOS | x86_64 (Intel) | `mutation-tools-x86_64-apple-darwin.zip` |
286+
| macOS | ARM64 (Apple Silicon) | `mutation-tools-aarch64-apple-darwin.zip` |
287+
| Windows | x86_64 | `mutation-tools-x86_64-windows.zip` |
288+
289+
## Documentation
290+
For usage instructions and examples, visit: https://github.com/eigerco/move-mutation-tools
291+
draft: true
292+
prerelease: false
293+
files: release-assets/*
294+
fail_on_unmatched_files: true
295+
generate_release_notes: true

.github/workflows/run-tests.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ jobs:
2929
name: Basic ci-check for tests
3030
steps:
3131
- uses: actions/checkout@v4
32-
32+
3333
- name: Install required deps
3434
run: sudo apt-get install libudev-dev libdw-dev lld libpq-dev libssl-dev pkg-config lsof build-essential ca-certificates clang curl git --no-install-recommends --assume-yes
3535

3636
- name: Get aptos-core
37-
shell: bash
38-
run: git clone https://github.com/aptos-labs/aptos-core.git
37+
uses: actions/checkout@v4
38+
with:
39+
repository: aptos-labs/aptos-core
40+
path: aptos-core
3941

4042
- name: Install related tools and prover dependencies
4143
shell: bash
@@ -54,13 +56,10 @@ jobs:
5456
echo "/home/$USER/.dotnet/tools" | tee -a $GITHUB_PATH
5557
5658
- name: Setup Rust toolchain
57-
uses: actions-rs/toolchain@v1
58-
with:
59-
profile: default
60-
toolchain: stable
59+
uses: actions-rust-lang/setup-rust-toolchain@v1
6160

6261
- name: Install nextest
6362
uses: taiki-e/install-action@nextest
6463

6564
- name: Run normal tests in the release mode due to test duration speed bump.
66-
run: cargo nextest run -r --profile ci
65+
run: RUSTFLAGS="--cfg tokio_unstable" cargo nextest run -r --profile ci

0 commit comments

Comments
 (0)