Skip to content

Commit 29f38e7

Browse files
committed
rust: add binary to validate tarballs
I've been wanting to add stronger validation of the produced archives. We started to do this in Python a few commits ago. However, we want to do some low-level validation and doing this in Python will be brittle. So this commit introduces a Rust binary. The first thing this binary does is validate zstd compressed tarballs and examine mach-o files for allowed library dependencies. It's a start. As part of this, we update CI to build the binary and run it to perform validation of the built tarball distribution.
1 parent 7a45924 commit 29f38e7

File tree

6 files changed

+491
-1
lines changed

6 files changed

+491
-1
lines changed

.github/workflows/linux.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,22 @@ jobs:
8787
with:
8888
python-version: '3.8'
8989

90+
- name: Install Rust
91+
uses: actions-rs/toolchain@v1
92+
with:
93+
toolchain: stable
94+
default: true
95+
profile: minimal
96+
9097
- name: Download sccache
9198
uses: actions/download-artifact@v2
9299
with:
93100
name: sccache
94101

95-
- name: Configure sccache
102+
- name: Start sccache
96103
run: |
97104
chmod +x sccache
105+
./sccache --start-server
98106
99107
- name: Build
100108
run: |
@@ -108,6 +116,11 @@ jobs:
108116
109117
./build-linux.py --target-triple ${{ matrix.triple }} --python ${{ matrix.py }} --optimizations ${{ matrix.optimizations }} ${EXTRA_ARGS}
110118
119+
- name: Validate Distribution
120+
run: |
121+
export RUSTC_WRAPPER=$(pwd)/sccache
122+
cargo run -- validate-distribution dist/*.tar.zst
123+
111124
- name: Upload Distribution
112125
uses: actions/upload-artifact@v2
113126
with:

.github/workflows/macos.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ jobs:
6868
with:
6969
python-version: '3.8'
7070

71+
- name: Install Rust
72+
uses: actions-rs/toolchain@v1
73+
with:
74+
toolchain: stable
75+
default: true
76+
profile: minimal
77+
7178
- name: Download sccache
7279
uses: actions/download-artifact@v2
7380
with:
@@ -83,6 +90,11 @@ jobs:
8390
export PYBUILD_RELEASE_TAG=$(git log -n 1 --date=format:%Y%m%dT%H%M%S --pretty=format:%ad)
8491
./build-macos.py --python ${{ matrix.py }} --optimizations ${{ matrix.optimizations }}
8592
93+
- name: Validate Distribution
94+
run: |
95+
export RUSTC_WRAPPER=$(pwd)/sccache
96+
cargo run -- validate-distribution dist/*.tar.zst
97+
8698
- name: Stop sccache
8799
continue-on-error: true
88100
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
build/
33
docs/_build/
44
dist/
5+
target/
56
venv/
67
__pycache__/

Cargo.lock

Lines changed: 325 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)