Skip to content

Commit 7b8355f

Browse files
authored
Debug bundle (#66)
1 parent fe66753 commit 7b8355f

34 files changed

+943
-80
lines changed

.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[registries.crates-io]
22
protocol = "sparse"
3+
4+
[target.x86_64-pc-windows-gnu]
5+
linker = "x86_64-w64-mingw32-gcc"

.github/workflows/dynamic-analysis.yml

+16-2
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ jobs:
99
matrix:
1010
include:
1111
- os: ubuntu-latest
12+
toolchain: stable
1213
- os: macos-latest
14+
toolchain: stable
1315
- os: windows-latest
16+
# Windows uses 1.68 until the napi issue fixed in [email protected]
17+
# percolates its way up our dependency graph.
18+
# https://github.com/MSxDOS/ntapi/issues/15
19+
# (will require a new `yaque` version, since that's what transitively pulls this in).
20+
toolchain: '1.68'
1421

1522
runs-on: ${{ matrix.os }}
1623
steps:
1724
- uses: actions/checkout@v3
1825
- uses: actions-rs/toolchain@v1
1926
with:
2027
profile: minimal
21-
toolchain: stable
28+
toolchain: ${{ matrix.toolchain }}
2229
- uses: Swatinem/rust-cache@v2
2330
with:
2431
shared-key: "dynamic-analysis"
@@ -42,16 +49,23 @@ jobs:
4249
matrix:
4350
include:
4451
- os: ubuntu-latest
52+
toolchain: stable
4553
- os: macos-latest
54+
toolchain: stable
4655
- os: windows-latest
56+
# Windows uses 1.68 until the napi issue fixed in [email protected]
57+
# percolates its way up our dependency graph.
58+
# https://github.com/MSxDOS/ntapi/issues/15
59+
# (will require a new `yaque` version, since that's what transitively pulls this in).
60+
toolchain: '1.68'
4761

4862
runs-on: ${{ matrix.os }}
4963
steps:
5064
- uses: actions/checkout@v3
5165
- uses: actions-rs/toolchain@v1
5266
with:
5367
profile: minimal
54-
toolchain: stable
68+
toolchain: ${{ matrix.toolchain }}
5569
- uses: Swatinem/rust-cache@v2
5670
with:
5771
shared-key: "dynamic-analysis"

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2+
## v0.2.0
3+
4+
Adds debug bundle generation to `broker fix`.
5+
Debug bundles are generated automatically if `broker fix` finds errors, or can be generated via `broker fix --export-bundle`.
6+
7+
For more information see the [`fix` subcommand documentation](https://github.com/fossas/broker/blob/main/docs/subcommands/fix.md)
8+
and the [debug bundle reference](https://github.com/fossas/broker/blob/main/docs/reference/debug-bundle.md).
9+
10+
Adds support for assigning newly imported projects to a team in FOSSA and setting their title.
11+
For more information, see the [config reference](https://github.com/fossas/broker/blob/main/docs/reference/config.md#integrations).
12+
113
## v0.1.1
214

315
Add `broker fix`

Cargo.lock

+88-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "broker"
3-
version = "0.1.1"
3+
version = "0.2.0"
44
edition = "2021"
55
description = "The bridge between FOSSA and internal DevOps services"
66
readme = "README.md"
@@ -14,7 +14,7 @@ rust-version = "1.68"
1414

1515
[dependencies]
1616
bytesize = { version = "1.2.0", features = ["serde"] }
17-
clap = { version = "4.2.2", features = ["derive", "cargo", "env"] }
17+
clap = { version = "4.2.4", features = ["derive", "cargo", "env"] }
1818
colored = "2.0.0"
1919
delegate = "0.9.0"
2020
derive-new = "0.5.9"
@@ -28,7 +28,7 @@ indoc = "2.0.1"
2828
once_cell = "1.17.1"
2929
rolling-file = "0.2.0"
3030
secrecy = { version = "0.8.0", features = ["serde"] }
31-
serde = { version = "1.0.159", features = ["derive"] }
31+
serde = { version = "1.0.160", features = ["derive"] }
3232
strum = { version = "0.24.1", features = ["derive"] }
3333
subtle = "2.4.1"
3434
tempfile = "3.5.0"
@@ -46,7 +46,7 @@ yaque = "0.6.4"
4646
reqwest = "0.11.16"
4747
zip = "0.6.4"
4848
bytes = "1.4.0"
49-
sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite", "migrate", "macros", "time", "offline"] }
49+
sqlx = { version = "0.6.3", features = ["runtime-tokio-rustls", "sqlite", "migrate", "macros", "time", "offline"] }
5050
async-trait = "0.1.68"
5151
semver = { version = "1.0.17", features = ["serde"] }
5252
tap = "1.0.1"
@@ -60,6 +60,10 @@ duplicate = "1.0.0"
6060
aho-corasick = "0.7.20"
6161
regex = "1.7.3"
6262
srclib = { git = "https://github.com/fossas/foundation-libs", branch = "add-srclib" }
63+
walkdir = "2.3.3"
64+
tar = "0.4.38"
65+
libflate = "1.3.0"
66+
typed-builder = "0.14.0"
6367

6468
[dev-dependencies]
6569
insta = { version = "1.29.0", features = ["filters", "json", "yaml"] }

docs/dev/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ cargo dist generate-ci github \
5050
--installer github-shell
5151
```
5252

53+
### cross compilation
54+
55+
Sometimes, especially when debugging a platform build issue, it's useful to "cross compile" the project
56+
from your home operating system to a destination operating system.
57+
58+
Steps to do so are located in the [cross compilation reference](./reference/cross-compile.md).
59+
5360
### snapshot testing
5461

5562
Broker uses [insta](https://docs.rs/insta) to perform snapshot testing of outputs.

docs/dev/reference/cross-compile.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Reference: Cross compilation
2+
3+
You're working on Broker with a macOS or Linux system, and everything is going great.
4+
5+
Satisfied with your work, you push a PR, and sit back to get a cup of coff-
6+
wait, what's that Windows build issue?
7+
8+
```
9+
error[E0793]: reference to packed field is unaligned
10+
--> C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.7\src\ntexapi.rs:2783:52
11+
|
12+
2783 | *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
16+
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
17+
```
18+
19+
You then spend several PR cycles trying to get this to be fixed, each time with a delay (and a bunch of wasteful parallel
20+
CI jobs running, whose results you don't care about).
21+
22+
Wouldn't it be better if instead, you could just build for Windows locally?
23+
24+
## The better way
25+
26+
You can! ✨
27+
28+
Steps:
29+
30+
1. Install the `mingw-64` package.
31+
- On macOS, that's `brew install mingw-w64`
32+
- On Debian/Ubuntu, that's `sudo apt-get install mingw-w64`
33+
1. `rustup target add x86_64-pc-windows-gnu`
34+
1. `cargo build --target x86_64-pc-windows-gnu`
35+
36+
Now your build still fails but at least your testing loop is faster 🥲

0 commit comments

Comments
 (0)