Skip to content

Commit 629780d

Browse files
committed
Merge branch 'installer-downloader'
2 parents a01d246 + 3c6af55 commit 629780d

Some content is hidden

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

69 files changed

+6910
-31
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Check file size"
2+
description: "Fails a file exceeds a given size limit"
3+
inputs:
4+
artifact:
5+
description: "Path to the file"
6+
required: true
7+
max_size:
8+
description: "Maximum allowed size in bytes"
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Check file size
14+
shell: bash
15+
run: |
16+
if [ -f "${{ inputs.artifact }}" ]; then
17+
if [ "$(uname)" = "Darwin" ]; then
18+
SIZE=$(stat -f %z "${{ inputs.artifact }}")
19+
else
20+
SIZE=$(stat -c %s "${{ inputs.artifact }}")
21+
fi
22+
echo "File size: $SIZE bytes"
23+
echo "Size limit: ${{ inputs.max_size }} bytes"
24+
25+
if [ "$SIZE" -gt "${{ inputs.max_size }}" ]; then
26+
echo "Error: Binary size exceeds limit."
27+
exit 1
28+
fi
29+
else
30+
echo "Error: File not found!"
31+
exit 1
32+
fi

.github/workflows/downloader.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: Installer downloader - Size test
3+
on:
4+
pull_request:
5+
paths:
6+
- '**'
7+
- '!**/**.md'
8+
- '!.github/workflows/**'
9+
- '.github/workflows/downloader.yml'
10+
- '!.github/CODEOWNERS'
11+
- '!android/**'
12+
- '!audits/**'
13+
- '!build.sh'
14+
- '!ci/**'
15+
- '!clippy.toml'
16+
- '!deny.toml'
17+
- '!rustfmt.toml'
18+
- '!.yamllint'
19+
- '!docs/**'
20+
- '!graphics/**'
21+
- '!desktop/**'
22+
- '!ios/**'
23+
- '!scripts/**'
24+
- '!.*ignore'
25+
- '!prepare-release.sh'
26+
- '!**/osv-scanner.toml'
27+
28+
permissions: {}
29+
30+
jobs:
31+
build-windows:
32+
strategy:
33+
matrix:
34+
config:
35+
- os: windows-latest
36+
arch: x64
37+
runs-on: ${{ matrix.config.os }}
38+
env:
39+
# If the file is larger than this, a regression has probably been introduced.
40+
# You should think twice before increasing this limit.
41+
MAX_BINARY_SIZE: 2621440
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: Build
47+
shell: bash
48+
env:
49+
# On Windows, the checkout is on the D drive, which is very small.
50+
# Moving the target directory to the C drive ensures that the runner
51+
# doesn't run out of space on the D drive.
52+
CARGO_TARGET_DIR: "C:/cargo-target"
53+
run: ./installer-downloader/build.sh
54+
55+
- name: Check file size
56+
uses: ./.github/actions/check-file-size
57+
with:
58+
artifact: "./dist/Install Mullvad VPN.exe"
59+
max_size: ${{ env.MAX_BINARY_SIZE }}
60+
61+
build-macos:
62+
runs-on: macos-latest
63+
env:
64+
# If the file is larger than this, a regression has probably been introduced.
65+
# You should think twice before increasing this limit.
66+
MAX_BINARY_SIZE: 3145728
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
71+
- name: Install Rust
72+
run: rustup target add x86_64-apple-darwin
73+
74+
- name: Build
75+
run: ./installer-downloader/build.sh
76+
77+
- name: Check file size
78+
uses: ./.github/actions/check-file-size
79+
with:
80+
artifact: "./dist/Install Mullvad VPN.dmg"
81+
max_size: ${{ env.MAX_BINARY_SIZE }}

0 commit comments

Comments
 (0)