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
name: CI
on:
push:
branches:
pull_request:
permissions:
contents: read
pages: write
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
# Lint + full test suite (unit + integration + parity). Ubuntu only: the tests
# are platform-independent and the parity fixtures are the same everywhere.
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.97.1"
components: rustfmt, clippy
# build.rs bundles web/ (esbuild) into the git-ignored web/dist/bundle.js
# that src/html.rs embeds, so node/npm are required to compile the crate.
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy (deny warnings)
run: cargo clippy --release --all-targets -- -D warnings
- name: Build
run: cargo build --release
- name: Test (unit + integration + parity)
run: cargo test --release
- name: Upload binary artifact
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: hprof-analyzer-linux
path: target/release/hprof-analyzer
retention-days: 1
# Deploy GitHub Pages only on main push, after build-test passes.
# Re-uses the binary artifact from build-test to avoid a second full Rust build.
deploy:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: build-test
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Cache cargo
uses: Swatinem/rust-cache@v2
# Download AFTER cache restore — rust-cache restores target/ and would
# overwrite the artifact if this step came first.
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: hprof-analyzer-linux
path: target/release
- name: Make binary executable
run: chmod +x target/release/hprof-analyzer
- name: Generate sample reports
run: BIN=$(pwd)/target/release/hprof-analyzer ./scripts/gen-samples.sh
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build browser REPL
run: bash scripts/build-browser.sh
- name: Install browser REPL as homepage
run: cp dist/hprof-analyzer-browser.html docs/index.html
- name: Copy sample hprof fixtures
run: |
cp tests/fixtures/dump_1_mnemonics.hprof docs/samples/dump_1_mnemonics.hprof
cp tests/fixtures/dump_2_scala-doku.hprof docs/samples/dump_2_scala-doku.hprof
cp tests/fixtures/dump_4_philosophers.hprof docs/samples/dump_4_philosophers.hprof
cp tests/fixtures/dump_7_gauss-mix.hprof docs/samples/dump_7_gauss-mix.hprof
- name: Build OQL guide
run: bash scripts/build-oql-guide.sh
- uses: actions/configure-pages@v5
with:
enablement: true
- uses: actions/upload-pages-artifact@v3
with:
path: docs
- id: deployment
uses: actions/deploy-pages@v4