Skip to content

Commit 9e65e53

Browse files
authored
Remove more files from the published package (#273)
* Add some testing to ci This commit changes te CI setup to run on all platforms with the packaged source code instead of the source code in the repository. This is usful for ensuring that everything required is included. This is the preparation for excluding more files from the release. Additionally this bumps the checkout action to version 5. * Exclude more stuff This commit excludes more files from the openssl source code from the code uploaded to crates.io. All of the excluded files are not required to build openssl on any target listed on ci. Before: 3699 files, 44.5MiB (10.0MiB compressed) After: 2383 files, 31.6MiB (6.8MiB compressed)
1 parent dcb0ea7 commit 9e65e53

File tree

4 files changed

+221
-151
lines changed

4 files changed

+221
-151
lines changed

.github/workflows/main.yml

Lines changed: 128 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -17,115 +17,138 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
include:
20-
- target: x86_64-unknown-linux-gnu
21-
rust: stable
22-
os: ubuntu-latest
23-
- target: x86_64-unknown-linux-gnu
24-
rust: beta
25-
os: ubuntu-latest
26-
- target: x86_64-unknown-linux-gnu
27-
rust: nightly
28-
os: ubuntu-latest
29-
- target: x86_64-apple-darwin
30-
rust: stable
31-
os: macos-latest
32-
- target: aarch64-apple-darwin
33-
rust: nightly
34-
os: macos-latest
35-
#- target: arm-linux-androideabi
36-
# rust: stable
37-
# os: ubuntu-latest
38-
#- target: aarch64-linux-android
39-
# rust: stable
40-
# os: ubuntu-latest
41-
#- target: i686-linux-android
42-
# rust: stable
43-
# os: ubuntu-latest
44-
#- target: x86_64-linux-android
45-
# rust: stable
46-
# os: ubuntu-latest
47-
- target: i686-unknown-linux-gnu
48-
rust: stable
49-
os: ubuntu-latest
50-
- target: arm-unknown-linux-gnueabi
51-
rust: stable
52-
os: ubuntu-latest
53-
- target: aarch64-unknown-linux-gnu
54-
rust: stable
55-
os: ubuntu-latest
56-
- target: riscv64gc-unknown-linux-gnu
57-
rust: stable
58-
os: ubuntu-latest
59-
- target: loongarch64-unknown-linux-gnu
60-
rust: stable
61-
os: ubuntu-latest
62-
- target: x86_64-unknown-linux-musl
63-
rust: stable
64-
os: ubuntu-latest
65-
- target: x86_64-pc-windows-gnu
66-
rust: stable
67-
os: ubuntu-latest
68-
# - target: wasm32-wasi
69-
# rust: stable
70-
# os: ubuntu-latest
71-
- target: i686-pc-windows-msvc
72-
rust: stable-i686-msvc
73-
os: windows-2022
74-
- target: i686-pc-windows-msvc
75-
rust: stable-i686-msvc
76-
os: windows-2022
77-
crt_static: yes
78-
- target: x86_64-pc-windows-msvc
79-
rust: stable-x86_64-msvc
80-
os: windows-latest
81-
- target: x86_64-pc-windows-msvc
82-
rust: stable-x86_64-msvc
83-
os: windows-latest
84-
crt_static: yes
85-
- target: x86_64-pc-windows-msvc
86-
rust: stable-x86_64-msvc
87-
os: windows-latest
88-
nasm_exe: installed
20+
- target: x86_64-unknown-linux-gnu
21+
rust: stable
22+
os: ubuntu-latest
23+
- target: x86_64-unknown-linux-gnu
24+
rust: beta
25+
os: ubuntu-latest
26+
- target: x86_64-unknown-linux-gnu
27+
rust: nightly
28+
os: ubuntu-latest
29+
- target: x86_64-apple-darwin
30+
rust: stable
31+
os: macos-latest
32+
- target: aarch64-apple-darwin
33+
rust: nightly
34+
os: macos-latest
35+
#- target: arm-linux-androideabi
36+
# rust: stable
37+
# os: ubuntu-latest
38+
#- target: aarch64-linux-android
39+
# rust: stable
40+
# os: ubuntu-latest
41+
#- target: i686-linux-android
42+
# rust: stable
43+
# os: ubuntu-latest
44+
#- target: x86_64-linux-android
45+
# rust: stable
46+
# os: ubuntu-latest
47+
- target: i686-unknown-linux-gnu
48+
rust: stable
49+
os: ubuntu-latest
50+
- target: arm-unknown-linux-gnueabi
51+
rust: stable
52+
os: ubuntu-latest
53+
- target: aarch64-unknown-linux-gnu
54+
rust: stable
55+
os: ubuntu-latest
56+
- target: riscv64gc-unknown-linux-gnu
57+
rust: stable
58+
os: ubuntu-latest
59+
- target: loongarch64-unknown-linux-gnu
60+
rust: stable
61+
os: ubuntu-latest
62+
- target: x86_64-unknown-linux-musl
63+
rust: stable
64+
os: ubuntu-latest
65+
- target: x86_64-pc-windows-gnu
66+
rust: stable
67+
os: ubuntu-latest
68+
# - target: wasm32-wasi
69+
# rust: stable
70+
# os: ubuntu-latest
71+
- target: i686-pc-windows-msvc
72+
rust: stable-i686-msvc
73+
os: windows-2022
74+
- target: i686-pc-windows-msvc
75+
rust: stable-i686-msvc
76+
os: windows-2022
77+
crt_static: yes
78+
- target: x86_64-pc-windows-msvc
79+
rust: stable-x86_64-msvc
80+
os: windows-latest
81+
- target: x86_64-pc-windows-msvc
82+
rust: stable-x86_64-msvc
83+
os: windows-latest
84+
crt_static: yes
85+
- target: x86_64-pc-windows-msvc
86+
rust: stable-x86_64-msvc
87+
os: windows-latest
88+
nasm_exe: installed
8989

9090
steps:
91-
- uses: actions/checkout@v1
92-
with:
93-
submodules: true
94-
- name: Install Rust (rustup)
95-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
96-
- run: rustup target add ${{ matrix.target }}
97-
- name: Set crt-static
98-
if: matrix.crt_static == 'yes'
99-
run: echo RUSTFLAGS=-Ctarget-feature=+crt-static >> $GITHUB_ENV
100-
- name: Use strawberry perl
101-
if: startsWith(matrix.os, 'windows')
102-
run: echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
103-
- name: Run tests (not Windows)
104-
if: "!startsWith(matrix.os, 'windows')"
105-
run: |
106-
set -e
107-
cargo generate-lockfile
108-
./ci/run-docker.sh ${{ matrix.target }}
109-
- name: Download nasm.exe (Windows)
110-
if: matrix.nasm_exe == 'installed'
111-
run: |
112-
WINNASMVERSION='2.15.05'
113-
curl -O https://www.nasm.us/pub/nasm/releasebuilds/${WINNASMVERSION}/win64/nasm-${WINNASMVERSION}-win64.zip
114-
unzip nasm-${WINNASMVERSION}-win64.zip
115-
echo "$GITHUB_WORKSPACE\\nasm-${WINNASMVERSION}" >> $GITHUB_PATH
116-
echo "OPENSSL_RUST_USE_NASM=1" >> $GITHUB_ENV
117-
- name: Run tests (Windows)
118-
if: startsWith(matrix.os, 'windows')
119-
run: |
120-
cargo test --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} -vv
121-
cargo test --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} --release -vv
122-
cargo run --release --target ${{ matrix.target }} --manifest-path testcrate/Cargo.toml --features package -vv
91+
- uses: actions/checkout@v5
92+
with:
93+
submodules: true
94+
- name: Install Rust (rustup)
95+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
96+
- run: rustup target add ${{ matrix.target }}
97+
- name: Set crt-static
98+
if: matrix.crt_static == 'yes'
99+
run: echo RUSTFLAGS=-Ctarget-feature=+crt-static >> $GITHUB_ENV
100+
- name: Use strawberry perl
101+
if: startsWith(matrix.os, 'windows')
102+
run: echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
103+
- name: package source
104+
run: |
105+
cargo package --no-verify
106+
- name: Check crate size
107+
if: runner.os == 'Linux'
108+
run: |
109+
crate=`ls target/package/*.crate`
110+
filesize=$(stat -c%s "$crate")
111+
echo "tarball is $filesize bytes"
112+
if (( filesize > 15000000 )); then
113+
echo "file size too big"
114+
exit 1
115+
fi
116+
- name: Patch test crate
117+
run: |
118+
(cd target/package && tar -xf openssl-src-*.crate && rm openssl-src-*.crate && mv openssl-src-* openssl-src)
119+
pwd
120+
ls target
121+
echo "---"
122+
ls target/package/openssl-src
123+
sed -i -e 's/\.\./\.\.\/target\/package\/openssl-src\//g' testcrate/Cargo.toml
124+
echo "[workspace]" >> testcrate/Cargo.toml
125+
cat testcrate/Cargo.toml
126+
- name: Run tests (not Windows)
127+
if: "!startsWith(matrix.os, 'windows')"
128+
run: |
129+
set -e
130+
cargo generate-lockfile --manifest-path=testcrate/Cargo.toml
131+
./ci/run-docker.sh ${{ matrix.target }}
132+
- name: Download nasm.exe (Windows)
133+
if: matrix.nasm_exe == 'installed'
134+
run: |
135+
WINNASMVERSION='2.15.05'
136+
curl -O https://www.nasm.us/pub/nasm/releasebuilds/${WINNASMVERSION}/win64/nasm-${WINNASMVERSION}-win64.zip
137+
unzip nasm-${WINNASMVERSION}-win64.zip
138+
echo "$GITHUB_WORKSPACE\\nasm-${WINNASMVERSION}" >> $GITHUB_PATH
139+
echo "OPENSSL_RUST_USE_NASM=1" >> $GITHUB_ENV
140+
- name: Run tests (Windows)
141+
if: startsWith(matrix.os, 'windows')
142+
run: |
143+
cargo test --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} -vv
144+
cargo test --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} --release -vv
145+
cargo run --release --target ${{ matrix.target }} --manifest-path testcrate/Cargo.toml --features package -vv
123146
124147
rustfmt:
125148
name: Rustfmt
126149
runs-on: ubuntu-latest
127150
steps:
128-
- uses: actions/checkout@v1
129-
- name: Install Rust
130-
run: rustup update stable && rustup default stable && rustup component add rustfmt
131-
- run: cargo fmt -- --check
151+
- uses: actions/checkout@v1
152+
- name: Install Rust
153+
run: rustup update stable && rustup default stable && rustup component add rustfmt
154+
- run: cargo fmt -- --check

Cargo.toml

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ description = """
1010
Source of OpenSSL and logic to build it.
1111
"""
1212
exclude = [
13+
'.github',
14+
'ci',
15+
'.gitignore',
16+
'.gitmodules',
17+
18+
# The current upload size limit for *.crate files is 10MB. Therefore, exclude
19+
# some unused documentation to meet this constraint.
1320
'openssl/fuzz/corpora/*',
1421
'openssl/pyca-cryptography/*',
1522
'openssl/wycheproof/*',
@@ -24,16 +31,80 @@ exclude = [
2431
'openssl/oqs-provider/*',
2532
'openssl/cloudflare-quiche/*',
2633
'openssl/pkcs11-provider/*',
27-
# The current upload size limit for *.crate files is 10MB. Therefore, exclude
28-
# some unused documentation to meet this constraint.
29-
'openssl/doc/man{3,5,7}',
30-
'.github',
31-
'ci',
32-
'.gitignore',
33-
'.gitmodules',
3434
'openssl/.ctags.d/',
3535
'openssl/.git-blame-ignore-revs',
3636
'openssl/.gitattributes',
37+
38+
'openssl/test',
39+
'openssl/**/*.plantuml',
40+
'openssl/dev',
41+
'openssl/**/*.sh',
42+
'openssl/**/*.md',
43+
44+
'openssl/external/perl/Text-Template-1.56/Changes',
45+
'openssl/external/perl/Text-Template-1.56/INSTALL',
46+
'openssl/external/perl/Text-Template-1.56/MANIFEST',
47+
'openssl/external/perl/Text-Template-1.56/META.json',
48+
'openssl/external/perl/Text-Template-1.56/META.yml',
49+
'openssl/external/perl/Text-Template-1.56/Makefile.PL',
50+
'openssl/external/perl/Text-Template-1.56/README',
51+
'openssl/external/perl/Text-Template-1.56/SIGNATURE',
52+
'openssl/util/providers.num',
53+
'openssl/util/platform_symbols/',
54+
'openssl/util/write-man-symlinks',
55+
'openssl/util/mk-fipsmodule-cnf.pl',
56+
'openssl/util/**/*.txt',
57+
'openssl/util/**/*.pl',
58+
'openssl/util/**/*.sed',
59+
'openssl/util/**/*.rb',
60+
'openssl/util/**/*.syms',
61+
'openssl/util/perl/TLSProxy',
62+
'openssl/util/merge-err-lines',
63+
'openssl/util/err-to-raise',
64+
'openssl/util/find-doc-nits',
65+
'openssl/util/find-unused-errs',
66+
'openssl/util/fix-deprecation',
67+
'openssl/util/fix-includes',
68+
'openssl/util/indent.pro',
69+
'openssl/util/check-malloc-errs',
70+
'openssl/util/perl/checkhandshake.pm',
71+
'openssl/util/check-format-test-negatives.c',
72+
'openssl/util/check-format-test-positives.c',
73+
'openssl/util/perl/OpenSSL/Test/',
74+
'openssl/funding.json',
75+
'openssl/fuzz/',
76+
'openssl/doc/',
77+
'openssl/**/*.pem',
78+
'openssl/**/*.srl',
79+
'openssl/**/*.crt',
80+
'openssl/**/*.cnf',
81+
'openssl/providers/fips-sources.checksums',
82+
'openssl/providers/fips.checksum',
83+
'openssl/providers/fips.module.sources',
84+
'openssl/Configurations/descrip.mms.tmpl',
85+
86+
'openssl/apps/demoSRP/srp_verifier.txt',
87+
'openssl/apps/demoSRP/srp_verifier.txt.attr',
88+
'openssl/crypto/err/openssl.txt',
89+
'openssl/crypto/objects/obj_xref.txt',
90+
'openssl/crypto/objects/objects.txt',
91+
'openssl/engines/e_afalg.txt',
92+
'openssl/engines/e_capi.txt',
93+
'openssl/engines/e_dasync.txt',
94+
'openssl/engines/e_loader_attic.txt',
95+
'openssl/engines/e_ossltest.txt',
96+
'openssl/external/perl/Downloaded.txt',
97+
98+
# these files are still required
99+
'!openssl/util/add-depends.pl',
100+
'!openssl/util/mkinstallvars.pl',
101+
'!openssl/util/dofile.pl',
102+
'!openssl/util/mkbuildinf.pl',
103+
'!openssl/util/mkdir-p.pl',
104+
'!openssl/util/mkrc.pl',
105+
'!openssl/util/echo.pl',
106+
'!openssl/util/copy.pl',
107+
'!openssl/**/build.info',
37108
]
38109

39110
[features]

ci/run-docker.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33
target=$1
44

55
if [ ! -d ci/docker/$1 ]; then
6-
exec ci/run.sh $1
6+
exec ci/run.sh $1
77
fi
88

99
set -ex
1010

1111
docker build \
12-
--rm \
13-
--tag openssl-src-ci \
14-
ci/docker/$1
12+
--rm \
13+
--tag openssl-src-ci \
14+
ci/docker/$1
1515

1616
docker run \
17-
--rm \
18-
--volume `rustc --print sysroot`:/rust:ro \
19-
--volume `pwd`:/usr/code:ro \
20-
--volume `pwd`/target:/usr/code/target \
21-
--volume $HOME/.cargo:/cargo \
22-
--env CARGO_HOME=/cargo \
23-
--workdir /usr/code \
24-
openssl-src-ci \
25-
bash -c "PATH=\"\$PATH:/rust/bin:/cargo/bin\" ci/run.sh $target"
26-
17+
--rm \
18+
--volume $(rustc --print sysroot):/rust:ro \
19+
--volume $(pwd):/usr/code:rw \
20+
--volume $(pwd)/target:/usr/code/target \
21+
--volume $HOME/.cargo:/cargo \
22+
--env CARGO_HOME=/cargo \
23+
--workdir /usr/code \
24+
openssl-src-ci \
25+
bash -c "PATH=\"\$PATH:/rust/bin:/cargo/bin\" ci/run.sh $target"

0 commit comments

Comments
 (0)