Skip to content

Commit 52b7f9f

Browse files
committed
Merge remote-tracking branch 'refs/remotes/upstream/main' into feat/dependents-api
# Conflicts: # apps/labrinth/src/routes/v3/projects.rs
2 parents 79df52c + 2cc6bc8 commit 52b7f9f

File tree

782 files changed

+31301
-7991
lines changed

Some content is hidden

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

782 files changed

+31301
-7991
lines changed

.cargo/config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Windows has stack overflows when calling from Tauri, so we increase compiler size
1+
# Windows has stack overflows when calling from Tauri, so we increase the default stack size used by the compiler
22
[target.'cfg(windows)']
3-
rustflags = ["-C", "link-args=/STACK:16777220"]
3+
rustflags = ["-C", "link-args=/STACK:16777220", "--cfg", "tokio_unstable"]
44

55
[build]
6-
rustflags = ["--cfg", "tokio_unstable"]
6+
rustflags = ["--cfg", "tokio_unstable"]

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ max_line_length = 100
1414
max_line_length = off
1515
trim_trailing_whitespace = false
1616

17-
[*.rs]
18-
indent_size = 4
17+
[*.{rs,java,kts}]
18+
indent_size = 4

.gitattributes

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
11
* text=auto eol=lf
2+
3+
# SQLx calculates a checksum of migration scripts at build time to compare
4+
# it with the checksum of the applied migration for the same version at
5+
# runtime, to know if the migration script has been changed, and thus the
6+
# DB schema went out of sync with the code.
7+
#
8+
# However, such checksum treats the script as a raw byte stream, taking
9+
# into account inconsequential differences like different line endings
10+
# in different OSes. When combined with Git's EOL conversion and mixed
11+
# native and cross-compilation scenarios, this leads to existing
12+
# migrations that didn't change having potentially different checksums
13+
# according to the environment they were built in, which can break the
14+
# migration system when deploying the Modrinth App, rendering it
15+
# unusable.
16+
#
17+
# The gitattribute above ensures that all text files are checked out
18+
# with LF line endings, but widely deployed app versions were built
19+
# without this attribute set, which left such line endings variable to
20+
# the platform. Thus, there is no perfect solution to this problem:
21+
# forcing CRLF here would break Linux and macOS users, forcing LF
22+
# breaks Windows users, and leaving it unspecified may still lead to
23+
# line ending differences when cross-compiling from Linux to Windows
24+
# or vice versa, or having Git configured with different line
25+
# conversion settings. Moreover, there is no `eol=native` attribute,
26+
# and using CI-only scripts to convert line endings would make the
27+
# builds differ between CI and most local environments. So, let's pick
28+
# the least bad option: let Git handle line endings using its
29+
# configuration by leaving it unspecified, which works fine as long as
30+
# people don't mess with Git's line ending settings, which is the vast
31+
# majority of cases.
32+
/packages/app-lib/migrations/20240711194701_init.sql !eol
33+
/packages/app-lib/migrations/20240813205023_drop-active-unique.sql !eol
34+
/packages/app-lib/migrations/20240930001852_disable-personalized-ads.sql !eol
35+
/packages/app-lib/migrations/20241222013857_feature-flags.sql !eol

.github/workflows/labrinth-docker.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ on:
1818
jobs:
1919
docker:
2020
runs-on: ubuntu-latest
21-
defaults:
22-
run:
23-
working-directory: ./apps/labrinth
2421
steps:
2522
- name: Checkout
2623
uses: actions/checkout@v2
@@ -38,8 +35,6 @@ jobs:
3835
- name: Build and push
3936
id: docker_build
4037
uses: docker/build-push-action@v2
41-
env:
42-
SQLX_OFFLINE: true
4338
with:
4439
file: ./apps/labrinth/Dockerfile
4540
push: ${{ github.event_name != 'pull_request' }}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Modrinth App build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- 'v*'
8+
paths:
9+
- .github/workflows/theseus-build.yml
10+
- 'apps/app/**'
11+
- 'apps/app-frontend/**'
12+
- 'packages/app-lib/**'
13+
- 'packages/app-macros/**'
14+
- 'packages/assets/**'
15+
- 'packages/ui/**'
16+
- 'packages/utils/**'
17+
workflow_dispatch:
18+
inputs:
19+
sign-windows-binaries:
20+
description: Sign Windows binaries
21+
type: boolean
22+
default: true
23+
required: false
24+
25+
jobs:
26+
build:
27+
name: Build
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
platform: [macos-latest, windows-latest, ubuntu-22.04]
32+
include:
33+
- platform: macos-latest
34+
artifact-target-name: universal-apple-darwin
35+
- platform: windows-latest
36+
artifact-target-name: x86_64-pc-windows-msvc
37+
- platform: ubuntu-22.04
38+
artifact-target-name: x86_64-unknown-linux-gnu
39+
40+
runs-on: ${{ matrix.platform }}
41+
42+
steps:
43+
- name: 📥 Check out code
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: 🧰 Setup Rust toolchain
49+
uses: actions-rust-lang/setup-rust-toolchain@v1
50+
with:
51+
rustflags: ''
52+
target: ${{ startsWith(matrix.platform, 'macos') && 'x86_64-apple-darwin' || '' }}
53+
54+
- name: 🧰 Install pnpm
55+
uses: pnpm/action-setup@v4
56+
57+
- name: 🧰 Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version-file: .nvmrc
61+
cache: pnpm
62+
63+
- name: 🧰 Install Linux build dependencies
64+
if: startsWith(matrix.platform, 'ubuntu')
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -yq libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev
68+
69+
- name: 🧰 Setup Dasel
70+
uses: jaxxstorm/action-install-gh-release@v2.1.0
71+
with:
72+
repo: TomWright/dasel
73+
tag: v2.8.1
74+
extension-matching: disable
75+
rename-to: ${{ startsWith(matrix.platform, 'windows') && 'dasel.exe' || 'dasel' }}
76+
chmod: 0755
77+
78+
- name: ⚙️ Set application version
79+
shell: bash
80+
run: |
81+
APP_VERSION="$(git describe --tags --always | sed -E 's/-([0-9]+)-(g[0-9a-fA-F]+)$/-canary+\1.\2/')"
82+
echo "Setting application version to $APP_VERSION"
83+
dasel put -f apps/app/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version'
84+
dasel put -f packages/app-lib/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version'
85+
dasel put -f apps/app-frontend/package.json -t string -v "${APP_VERSION#v}" 'version'
86+
87+
- name: 💨 Setup Turbo cache
88+
uses: rharkor/caching-for-turbo@v1.8
89+
90+
- name: 🧰 Install dependencies
91+
run: pnpm install
92+
93+
- name: ✍️ Set up Windows code signing
94+
if: startsWith(matrix.platform, 'windows')
95+
shell: bash
96+
run: |
97+
if [ '${{ startsWith(github.ref, 'refs/tags/v') || inputs.sign-windows-binaries }}' = 'true' ]; then
98+
choco install jsign --ignore-dependencies # GitHub runners come with a global Java installation already
99+
else
100+
dasel delete -f apps/app/tauri-release.conf.json 'bundle.windows.signCommand'
101+
fi
102+
103+
- name: 🔨 Build macOS app
104+
run: pnpm --filter=@modrinth/app run tauri build --target universal-apple-darwin --config tauri-release.conf.json
105+
if: startsWith(matrix.platform, 'macos')
106+
env:
107+
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
108+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
109+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
110+
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
111+
APPLE_ID: ${{ secrets.APPLE_ID }}
112+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
113+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
114+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
115+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
116+
117+
- name: 🔨 Build Linux app
118+
run: pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json
119+
if: startsWith(matrix.platform, 'ubuntu')
120+
env:
121+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
122+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
123+
124+
- name: 🔨 Build Windows app
125+
run: |
126+
[System.Convert]::FromBase64String("$env:DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_BASE64") | Set-Content -Path signer-client-cert.p12 -AsByteStream
127+
$env:DIGICERT_ONE_SIGNER_CREDENTIALS = "$env:DIGICERT_ONE_SIGNER_API_KEY|$PWD\signer-client-cert.p12|$env:DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_PASSWORD"
128+
$env:JAVA_HOME = "$env:JAVA_HOME_11_X64"
129+
pnpm --filter=@modrinth/app run tauri build --config tauri-release.conf.json --verbose --bundles 'nsis,updater'
130+
Remove-Item -Path signer-client-cert.p12 -ErrorAction SilentlyContinue
131+
if: startsWith(matrix.platform, 'windows')
132+
env:
133+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
134+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
135+
DIGICERT_ONE_SIGNER_API_KEY: ${{ secrets.DIGICERT_ONE_SIGNER_API_KEY }}
136+
DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_BASE64: ${{ secrets.DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_BASE64 }}
137+
DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_PASSWORD: ${{ secrets.DIGICERT_ONE_SIGNER_CLIENT_CERTIFICATE_PASSWORD }}
138+
139+
- name: 📤 Upload app bundles
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: App bundle (${{ matrix.artifact-target-name }})
143+
path: |
144+
target/release/bundle/appimage/Modrinth App_*.AppImage*
145+
target/release/bundle/deb/Modrinth App_*.deb*
146+
target/release/bundle/rpm/Modrinth App-*.rpm*
147+
target/universal-apple-darwin/release/bundle/macos/Modrinth App.app.tar.gz*
148+
target/universal-apple-darwin/release/bundle/dmg/Modrinth App_*.dmg*
149+
target/release/bundle/nsis/Modrinth App_*-setup.exe*
150+
target/release/bundle/nsis/Modrinth App_*-setup.nsis.zip*

0 commit comments

Comments
 (0)