Skip to content

Commit

Permalink
Merge branch 'main' of github.com:spacedriveapp/spacedrive into tag-a…
Browse files Browse the repository at this point in the history
…ssign-mode
  • Loading branch information
iLynxcat committed May 21, 2024
2 parents 6b3496a + 96a45ee commit cd8f1a0
Show file tree
Hide file tree
Showing 1,182 changed files with 62,541 additions and 28,972 deletions.
5 changes: 5 additions & 0 deletions .cspell/project_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ codegen
Condvar
dashmap
davidmytton
dayjs
deel
elon
encryptor
Exif
Flac
graps
haden
Expand Down Expand Up @@ -57,8 +59,11 @@ spacetunnel
specta
storedkey
stringly
thumbstrips
tobiaslutke
tokio
typecheck
uuid
vdfs
vijay
zacharysmith
Expand Down
20 changes: 10 additions & 10 deletions .github/actions/publish-artifacts/dist/index.js

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions .github/actions/publish-artifacts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,30 @@ type OS = 'darwin' | 'windows' | 'linux';
type Arch = 'x64' | 'arm64';
type TargetConfig = { bundle: string; ext: string };
type BuildTarget = {
updater: TargetConfig;
updater: false | { bundle: string; bundleExt: string; archiveExt: string };
standalone: Array<TargetConfig>;
};

const OS_TARGETS = {
darwin: {
updater: {
bundle: 'macos',
ext: 'app.tar.gz'
bundleExt: 'app',
archiveExt: 'tar.gz'
},
standalone: [{ ext: 'dmg', bundle: 'dmg' }]
},
windows: {
updater: {
bundle: 'msi',
ext: 'msi.zip'
bundleExt: 'msi',
archiveExt: 'zip'
},
standalone: [{ ext: 'msi', bundle: 'msi' }]
},
linux: {
updater: {
bundle: 'appimage',
ext: 'AppImage.tar.gz'
},
standalone: [
{ ext: 'deb', bundle: 'deb' },
{ ext: 'AppImage', bundle: 'appimage' }
]
updater: false,
standalone: [{ ext: 'deb', bundle: 'deb' }]
}
} satisfies Record<OS, BuildTarget>;

Expand All @@ -54,13 +50,16 @@ async function globFiles(pattern: string) {
return await globber.glob();
}

async function uploadUpdater({ bundle, ext }: TargetConfig) {
const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${ext}*`);
async function uploadUpdater(updater: BuildTarget['updater']) {
if (!updater) return;
const { bundle, bundleExt, archiveExt } = updater;
const fullExt = `${bundleExt}.${archiveExt}`;
const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${fullExt}*`);

const updaterPath = files.find((file) => file.endsWith(ext));
const updaterPath = files.find((file) => file.endsWith(fullExt));
if (!updaterPath) return console.error(`Updater path not found. Files: ${files}`);

const artifactPath = `${ARTIFACTS_DIR}/${UPDATER_ARTIFACT_NAME}.${ext}`;
const artifactPath = `${ARTIFACTS_DIR}/${UPDATER_ARTIFACT_NAME}.${archiveExt}`;

// https://tauri.app/v1/guides/distribution/updater#update-artifacts
await io.cp(updaterPath, artifactPath);
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8.x.x
version: 9.0.6

- name: Install Node.js
uses: actions/setup-node@v4
Expand Down
49 changes: 24 additions & 25 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ runs:
steps:
- name: Install Rust
id: toolchain
uses: dtolnay/rust-toolchain@stable
uses: IronCoreLabs/rust-toolchain@v1
with:
target: ${{ inputs.target }}
toolchain: '1.75'
components: clippy, rustfmt

- name: Cache Rust Dependencies
Expand All @@ -35,27 +34,6 @@ runs:
shell: bash
run: echo '{}' | npx -y mustache - .cargo/config.toml.mustache .cargo/config.toml

- name: Turn Off Debuginfo and bump opt-level
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
sed '/\[profile.dev]/a\
debug = 0
' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
sed '/\[profile.dev]/a\
opt-level=1
' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
- name: Turn Off Debuginfo and bump opt-level
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
(Get-Content Cargo.toml) -replace '\[profile.dev\]', '[profile.dev]
debug = 0' | Set-Content Cargo.toml
(Get-Content Cargo.toml) -replace '\[profile.dev\]', '[profile.dev]
opt-level=1' | Set-Content Cargo.toml
- name: Restore cached Prisma codegen
id: cache-prisma-restore
uses: actions/cache/restore@v4
Expand All @@ -67,11 +45,32 @@ runs:
working-directory: core
if: ${{ steps.cache-prisma-restore.outputs.cache-hit != 'true' }}
shell: bash
run: cargo prisma generate
run: |
set -euxo pipefail
cargo prisma generate
# Check if a new migration should be created due to changes in the schema
cargo prisma migrate dev -n test --create-only --skip-generate
_new_migrations="$(
git ls-files --others --exclude-standard \
| { grep '^prisma/migrations/' || true; } \
| xargs sh -euxc '[ "$#" -lt 2 ] || grep -L "$@" || true' sh 'This is an empty migration' \
| wc -l \
| awk '{$1=$1};1'
)"
if [ "$_new_migrations" -gt 0 ]; then
echo "::error file=core/prisma/schema.prisma,title=Missing migration::New migration should be generated due to changes in prisma schema"
case "$GITHUB_REF" in
"refs/heads/main" | "refs/heads/gh-readonly-queue/main/"* | "refs/tags/"*)
# Fail action if we are on main or a release tag, to avoid releasing an app with a broken db
exit 1
;;
esac
fi
- name: Save Prisma codegen
id: cache-prisma-save
if: ${{ steps.cache-prisma-restore.outputs.cache-hit != 'true' }}
if: ${{ steps.cache-prisma-restore.outputs.cache-hit != 'true' && (github.ref == 'refs/heads/main' || inputs.save-cache == 'true') }}
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-prisma-restore.outputs.cache-primary-key }}
Expand Down
20 changes: 19 additions & 1 deletion .github/actions/setup-system/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ runs:
key: ${{ steps.cache-llvm-restore.outputs.cache-primary-key }}
path: C:/Program Files/LLVM

- name: Install current Bash on macOS
shell: bash
if: runner.os == 'macOS'
run: brew install bash

- name: Install Nasm
if: ${{ runner.os != 'Linux' }}
uses: ilammy/setup-nasm@v1
Expand All @@ -53,6 +58,19 @@ runs:
curl -L# 'https://github.com/rui314/mold/releases/download/v2.4.0/mold-2.4.0-x86_64-linux.tar.gz' \
| sudo tar -xzf- -C /usr/local
- name: Remove 32-bit libs and incompatible pre-installed pkgs from Runner
shell: bash
if: ${{ runner.os == 'Linux' }}
run: |
set -eux
if dpkg -l | grep i386; then
sudo apt-get purge --allow-remove-essential libc6-i386 ".*:i386" || true
sudo dpkg --remove-architecture i386 || true
fi
# https://github.com/actions/runner-images/issues/9546#issuecomment-2014940361
sudo apt-get remove libunwind-* || true
- name: Setup Rust and Dependencies
uses: ./.github/actions/setup-rust
with:
Expand All @@ -78,4 +96,4 @@ runs:
pushd scripts
npm i --production
popd
node scripts/preprep.mjs
env NODE_ENV=debug node scripts/preprep.mjs
13 changes: 8 additions & 5 deletions .github/workflows/cache-factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ jobs:
target: x86_64-pc-windows-msvc
# - host: windows-latest
# target: aarch64-pc-windows-msvc
- host: ubuntu-20.04
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
# - host: ubuntu-20.04
# - host: ubuntu-22.04
# target: x86_64-unknown-linux-musl
# - host: ubuntu-20.04
# - host: uubuntu-22.04
# target: aarch64-unknown-linux-gnu
# - host: ubuntu-20.04
# - host: ubuntu-22.04
# target: aarch64-unknown-linux-musl
# - host: ubuntu-20.04
# - host: ubuntu-22.04
# target: armv7-unknown-linux-gnueabihf
name: 'Make Cache'
runs-on: ${{ matrix.settings.host }}
if: github.repository == 'spacedriveapp/spacedrive'
permissions: {}
timeout-minutes: 150 # 2.5 hours
steps:
- name: Maximize build space
if: ${{ runner.os == 'Linux' }}
Expand Down
Loading

0 comments on commit cd8f1a0

Please sign in to comment.