Skip to content

Commit a0026d4

Browse files
authored
Get rid of cross-rs (#270)
1 parent 88ce8ee commit a0026d4

11 files changed

Lines changed: 407 additions & 433 deletions

.github/workflows/lint-web.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
submodules: recursive
3131
- uses: actions/setup-node@v6
3232
with:
33-
node-version: 24
33+
node-version: 25
3434
- name: install deps
3535
working-directory: ./web
3636
run: |

.github/workflows/release.yml

Lines changed: 152 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
99
cancel-in-progress: true
1010

11+
env:
12+
SQLX_OFFLINE: "1"
13+
# sccache
14+
SCCACHE_GHA_ENABLED: "true"
15+
RUSTC_WRAPPER: "sccache"
16+
1117
jobs:
1218
build-docker-release:
1319
# Ignore tags with -, like v1.0.0-alpha
@@ -45,41 +51,26 @@ jobs:
4551
steps:
4652
- name: Create GitHub release
4753
id: release
48-
uses: softprops/action-gh-release@v2
49-
if: startsWith(github.ref, 'refs/tags/')
54+
uses: shogo82148/actions-create-release@v1
5055
with:
5156
draft: true
5257
generate_release_notes: true
5358

5459
create-sbom:
55-
needs: [create-release, build-docker-release]
60+
needs:
61+
- create-release
62+
- build-docker-release
5663
uses: ./.github/workflows/sbom.yml
5764
with:
5865
upload_url: ${{ needs.create-release.outputs.upload_url }}
5966

6067
build-binaries:
61-
needs: [create-release]
68+
needs:
69+
- create-release
6270
runs-on:
6371
- self-hosted
64-
- ${{ matrix.os }}
72+
- Linux
6573
- X64
66-
strategy:
67-
fail-fast: false
68-
matrix:
69-
build: [linux, linux-arm64, freebsd]
70-
include:
71-
- build: linux
72-
arch: amd64
73-
os: Linux
74-
target: x86_64-unknown-linux-gnu
75-
- build: linux-arm64
76-
arch: arm64
77-
os: Linux
78-
target: aarch64-unknown-linux-gnu
79-
- build: freebsd
80-
arch: amd64
81-
os: Linux
82-
target: x86_64-unknown-freebsd
8374
steps:
8475
# Store the version, stripping any v-prefix
8576
- name: Write release version
@@ -93,104 +84,177 @@ jobs:
9384
with:
9485
submodules: recursive
9586

87+
- name: Install NodeJS
88+
uses: actions/setup-node@v6
89+
with:
90+
node-version: 25
91+
92+
- name: Install pnpm
93+
uses: pnpm/action-setup@v6
94+
with:
95+
cache: true
96+
version: 10
97+
98+
# Change to '--frozen-lockfile' once this gets fixed:
99+
# https://github.com/pnpm/action-setup/issues/40
100+
- name: Build frontend
101+
run: pnpm install --ignore-scripts --no-frozen-lockfile && pnpm build
102+
working-directory: web
103+
96104
- name: Install Rust stable
97-
uses: actions-rs/toolchain@v1
105+
uses: dtolnay/rust-toolchain@stable
98106
with:
99-
toolchain: 1.89.0 # "stable" causes rust-lld: error on aarch64-linux target: ${{ matrix.target }}
100-
override: true
107+
targets: "aarch64-unknown-linux-gnu"
101108

102-
- name: Setup `packer`
103-
uses: hashicorp/setup-packer@main
104-
id: setup
109+
- name: Run sccache-cache
110+
uses: mozilla-actions/sccache-action@v0.0.9
105111

106-
- name: Set up Docker BuildX
107-
uses: docker/setup-buildx-action@v4
112+
- name: Build Linux x86_64 binary
113+
run: |
114+
cargo build --locked --release --target x86_64-unknown-linux-gnu
115+
mv target/x86_64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu
116+
tar -zcf defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \
117+
defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu
118+
119+
- name: Build Linux aarch64 binary
120+
env:
121+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
122+
PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu
123+
run: |
124+
cargo build --locked --release --target aarch64-unknown-linux-gnu
125+
mv target/aarch64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu
126+
tar -zcf defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \
127+
defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu
128+
129+
- name: Build FreeBSD binary
130+
run: |
131+
rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/
132+
ssh root@freebsd 'cd work && cargo build --locked --release'
133+
scp root@freebsd:work/target/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd
134+
tar -zcf defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \
135+
defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd
136+
137+
- name: Build x86_64 DEB package
138+
uses: defGuard/fpm-action@main
108139
with:
109-
config-inline: |
110-
[registry."docker.io"]
111-
mirrors = ["dockerhub-proxy.teonite.net"]
140+
fpm_args:
141+
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-proxy
142+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
143+
example-config.toml=/etc/defguard/proxy.toml"
144+
fpm_opts: "--architecture amd64 --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb"
112145

113-
- name: Install pnpm
114-
uses: pnpm/action-setup@v4
146+
- name: Build aarch64 DEB package
147+
uses: defGuard/fpm-action@main
115148
with:
116-
# FIXME: temporarily pinned because of https://github.com/pnpm/pnpm/pull/9959
117-
version: 10.17
149+
fpm_args:
150+
"defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
151+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
152+
example-config.toml=/etc/defguard/proxy.toml"
153+
fpm_opts: "--architecture arm64 --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb"
118154

119-
- name: Use Node.js
120-
uses: actions/setup-node@v6
155+
- name: Build x86_64 RPM package
156+
uses: defGuard/fpm-action@main
121157
with:
122-
node-version: 25
123-
cache: "pnpm"
124-
cache-dependency-path: ./web/pnpm-lock.yaml
158+
fpm_args:
159+
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-proxy
160+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
161+
example-config.toml=/etc/defguard/proxy.toml"
162+
fpm_opts: "--architecture amd64 --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm"
125163

126-
- name: Install frontend dependencies
127-
run: pnpm install --ignore-scripts --frozen-lockfile
128-
working-directory: web
164+
- name: Build aarch64 RPM package
165+
uses: defGuard/fpm-action@main
166+
with:
167+
fpm_args:
168+
"defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
169+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
170+
example-config.toml=/etc/defguard/proxy.toml"
171+
fpm_opts: "--architecture arm64 --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-freebsd.rpm"
129172

130-
- name: Build frontend
131-
run: pnpm build
132-
working-directory: web
173+
- name: Build FreeBSD package
174+
uses: defGuard/fpm-action@main
175+
with:
176+
fpm_args:
177+
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-proxy
178+
defguard-proxy.service.freebsd=/usr/local/etc/rc.d/defguard-proxy
179+
example-config.toml=/etc/defguard/proxy.toml"
180+
fpm_opts: "--architecture amd64 --output-type freebsd --version ${{ env.VERSION }} --package defguard-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg --freebsd-osversion '*' --depends openssl"
133181

134-
- name: Build release binary
135-
uses: actions-rs/cargo@v1
182+
- name: Upload Linux x86_64 archive
183+
uses: shogo82148/actions-upload-release-asset@v1
184+
env:
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136186
with:
137-
use-cross: true
138-
command: build
139-
args: --locked --release --target ${{ matrix.target }}
187+
upload_url: ${{ needs.create-release.outputs.upload_url }}
188+
asset_path: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
189+
asset_content_type: application/gzip
190+
overwrite: true
140191

141-
- name: Rename binary
142-
run: mv target/${{ matrix.target }}/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
192+
- name: Upload Linux aarch64 archive
193+
uses: shogo82148/actions-upload-release-asset@v1
194+
env:
195+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
196+
with:
197+
upload_url: ${{ needs.create-release.outputs.upload_url }}
198+
asset_path: defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz
199+
asset_content_type: application/gzip
200+
overwrite: true
143201

144-
- name: Tar
145-
uses: a7ul/tar-action@v1.2.0
202+
- name: Upload FreeBSD x86_64 archive
203+
uses: shogo82148/actions-upload-release-asset@v1
204+
env:
205+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146206
with:
147-
command: c
148-
files: |
149-
defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
150-
outPath: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
207+
upload_url: ${{ needs.create-release.outputs.upload_url }}
208+
asset_path: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz
209+
asset_content_type: application/gzip
210+
overwrite: true
151211

152-
- name: Upload release archive
153-
uses: actions/upload-release-asset@v1.0.2
212+
- name: Upload Linux x86_64 DEB
213+
uses: shogo82148/actions-upload-release-asset@v1
154214
env:
155215
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156216
with:
157217
upload_url: ${{ needs.create-release.outputs.upload_url }}
158-
asset_path: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
159-
asset_name: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
160-
asset_content_type: application/octet-stream
218+
asset_path: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
219+
asset_content_type: application/gzip
220+
overwrite: true
161221

162-
- name: Build DEB package
163-
if: matrix.build == 'linux'
164-
uses: bpicode/github-action-fpm@master
222+
- name: Upload Linux aarch64 DEB
223+
uses: shogo82148/actions-upload-release-asset@v1
224+
env:
225+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165226
with:
166-
fpm_args: "defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
167-
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb"
227+
upload_url: ${{ needs.create-release.outputs.upload_url }}
228+
asset_path: defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb
229+
asset_content_type: application/gzip
230+
overwrite: true
168231

169-
- name: Upload DEB
170-
if: matrix.build == 'linux'
171-
uses: actions/upload-release-asset@v1.0.2
232+
- name: Upload Linux x86_64 RPM
233+
uses: shogo82148/actions-upload-release-asset@v1
172234
env:
173235
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174236
with:
175237
upload_url: ${{ needs.create-release.outputs.upload_url }}
176-
asset_path: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
177-
asset_name: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
178-
asset_content_type: application/octet-stream
238+
asset_path: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm
239+
asset_content_type: application/gzip
240+
overwrite: true
179241

180-
- name: Build RPM package
181-
if: matrix.build == 'linux'
182-
uses: bpicode/github-action-fpm@master
242+
- name: Upload Linux aarch64 RPM
243+
uses: shogo82148/actions-upload-release-asset@v1
244+
env:
245+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183246
with:
184-
fpm_args: "defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
185-
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm"
247+
upload_url: ${{ needs.create-release.outputs.upload_url }}
248+
asset_path: defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm
249+
asset_content_type: application/gzip
250+
overwrite: true
186251

187-
- name: Upload RPM
188-
if: matrix.build == 'linux'
189-
uses: actions/upload-release-asset@v1.0.2
252+
- name: Upload FreeBSD package
253+
uses: shogo82148/actions-upload-release-asset@v1
190254
env:
191255
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
192256
with:
193257
upload_url: ${{ needs.create-release.outputs.upload_url }}
194-
asset_path: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
195-
asset_name: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
196-
asset_content_type: application/octet-stream
258+
asset_path: defguard-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
259+
asset_content_type: application/x-pkg
260+
overwrite: true

.github/workflows/sbom.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
severity: "CRITICAL,HIGH,MEDIUM,LOW"
4343
scanners: "vuln"
4444

45-
- name: Create docker image SBOM with Trivy
45+
- name: Create Docker image SBOM with Trivy
4646
uses: aquasecurity/trivy-action@0.35.0
4747
with:
4848
image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}"
@@ -62,7 +62,7 @@ jobs:
6262
severity: "CRITICAL,HIGH,MEDIUM,LOW"
6363
scanners: "vuln"
6464

65-
- name: Create docker image security advisory file with Trivy
65+
- name: Create Docker image security advisory file with Trivy
6666
uses: aquasecurity/trivy-action@0.35.0
6767
with:
6868
image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}"
@@ -79,5 +79,5 @@ jobs:
7979
with:
8080
upload_url: ${{ inputs.upload_url }}
8181
asset_path: "defguard-*.json"
82-
asset_content_type: application/octet-stream
82+
asset_content_type: application/json
8383
overwrite: true

.github/workflows/update-repositories.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
else
4848
codename="trixie"
4949
fi
50-
50+
5151
echo "Uploading $deb_file to $codename"
5252
deb-s3 upload -l \
5353
--bucket=apt.defguard.net \
@@ -73,8 +73,8 @@ jobs:
7373
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_APT }}
7474
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_APT }}
7575
export AWS_REGION=eu-north-1
76-
sudo apt update -y
77-
sudo apt install -y awscli curl jq
76+
sudo apt-get update -y
77+
sudo apt-get install -y awscli curl jq
7878
7979
for DIST in trixie bookworm; do
8080
aws s3 cp s3://apt.defguard.net/dists/${DIST}/Release .

0 commit comments

Comments
 (0)