mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-02 10:03:28 +00:00
Fix CI (#242)
This commit is contained in:
parent
fd01e61123
commit
79fa96c3bd
60
.github/actions/build-server-image/action.yml
vendored
60
.github/actions/build-server-image/action.yml
vendored
|
@ -1,60 +0,0 @@
|
||||||
name: Build Server Image
|
|
||||||
description: Builds and publishes the docker image for the Spacedrive server
|
|
||||||
inputs:
|
|
||||||
gh_token:
|
|
||||||
description: 'A Github PAT'
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ inputs.gh_token }}
|
|
||||||
|
|
||||||
- name: Build Server
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cargo build --release -p server
|
|
||||||
cp ./target/release/server ./apps/server/server
|
|
||||||
|
|
||||||
- name: Determine image name & tag
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ "$GITHUB_EVENT_NAME" == "release" ]; then
|
|
||||||
export IMAGE_TAG=${GITHUB_REF##*/}
|
|
||||||
else
|
|
||||||
export IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")
|
|
||||||
fi
|
|
||||||
export GITHUB_REPOSITORY_LOWER=$(echo $GITHUB_REPOSITORY | awk '{print tolower($0)}')
|
|
||||||
export IMAGE_NAME="ghcr.io/$GITHUB_REPOSITORY_LOWER/server"
|
|
||||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
|
||||||
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
|
|
||||||
echo "Building $IMAGE_NAME:$IMAGE_TAG"
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker build ./apps/server --tag $IMAGE_NAME:$IMAGE_TAG
|
|
||||||
|
|
||||||
- name: Push Docker image
|
|
||||||
shell: bash
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
run: |
|
|
||||||
docker push $IMAGE_NAME:$IMAGE_TAG
|
|
||||||
|
|
||||||
- name: Tag & push image as latest staging image
|
|
||||||
if: github.event_name != 'release'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:staging
|
|
||||||
docker push $IMAGE_NAME:staging
|
|
||||||
|
|
||||||
- name: Tag & push image as latest production image
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:production
|
|
||||||
docker push $IMAGE_NAME:production
|
|
44
.github/actions/install-deps/action.yaml
vendored
44
.github/actions/install-deps/action.yaml
vendored
|
@ -1,44 +0,0 @@
|
||||||
name: Install dependencies
|
|
||||||
description: Installs OS-specific dependencies for builds
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Install ffmpeg & tauri deps (Ubuntu)
|
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --no-install-recommends \
|
|
||||||
libssl-dev \
|
|
||||||
libavcodec-dev \
|
|
||||||
libavdevice-dev \
|
|
||||||
libavfilter-dev \
|
|
||||||
libavformat-dev \
|
|
||||||
libavresample-dev \
|
|
||||||
libavutil-dev \
|
|
||||||
libswscale-dev \
|
|
||||||
libswresample-dev \
|
|
||||||
ffmpeg \
|
|
||||||
libgtk-3-dev \
|
|
||||||
webkit2gtk-4.0 \
|
|
||||||
libappindicator3-dev \
|
|
||||||
librsvg2-dev \
|
|
||||||
patchelf
|
|
||||||
|
|
||||||
- name: Install ffmpeg (macOS)
|
|
||||||
if: matrix.platform == 'macos-latest'
|
|
||||||
shell: bash
|
|
||||||
run: brew install ffmpeg
|
|
||||||
|
|
||||||
- name: Install vcpkg & ffmpeg (Windows)
|
|
||||||
if: matrix.platform == 'windows-latest'
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
|
||||||
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
|
||||||
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z
|
|
||||||
7z x ffmpeg-release-full-shared.7z
|
|
||||||
mkdir ffmpeg
|
|
||||||
mv ffmpeg-*/* ffmpeg/
|
|
||||||
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
|
|
||||||
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
|
|
|
@ -1,5 +0,0 @@
|
||||||
name: 'Install ffmpeg macOS'
|
|
||||||
description: 'Installs ffmpeg with caching for macOS'
|
|
||||||
runs:
|
|
||||||
using: 'node16'
|
|
||||||
main: 'index.js'
|
|
|
@ -1,8 +0,0 @@
|
||||||
// @ts-check
|
|
||||||
const core = require('@actions/core');
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
const github = require('@actions/github');
|
|
||||||
|
|
||||||
// const folders =
|
|
||||||
|
|
||||||
exec.exec('brew', ['install', 'ffmpeg']);
|
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
"name": "install-ffmpeg-macos",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Brendan Allan",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": "^1.6.0",
|
|
||||||
"@actions/exec": "^1.1.1",
|
|
||||||
"@actions/github": "^5.0.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +1,41 @@
|
||||||
name: Publish desktop artifacts
|
name: Publish artifacts
|
||||||
description: Publishes desktop artifacts after Tauri build
|
description: Publishes artifacts after CI process
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Make AppImage executable
|
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
|
||||||
shell: bash
|
|
||||||
run: chmod +x ./target/release/bundle/appimage/spacedrive*.AppImage
|
|
||||||
|
|
||||||
- name: Determine short GitHub SHA
|
- name: Determine short GitHub SHA
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
export GITHUB_SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")
|
export GITHUB_SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT" >> $GITHUB_ENV
|
echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set AppImage file permissions & compress it
|
||||||
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
chmod +x ./target/release/bundle/appimage/spacedrive*.AppImage
|
||||||
|
tar -czvf ./Spacedrive-AppImage-${{ env.GITHUB_SHA_SHORT }}.tar.gz ./target/release/bundle/appimage/spacedrive*.AppImage
|
||||||
|
|
||||||
- name: Publish artifacts (AppImage)
|
- name: Publish artifacts (AppImage)
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Spacedrive-AppImage-${{ env.GITHUB_SHA_SHORT }}
|
name: Spacedrive-AppImage-${{ env.GITHUB_SHA_SHORT }}
|
||||||
path: ./target/release/bundle/appimage/spacedrive*.AppImage
|
path: ./Spacedrive-AppImage-${{ env.GITHUB_SHA_SHORT }}.tar.gz
|
||||||
|
|
||||||
|
- name: Publish artifacts (deb)
|
||||||
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Spacedrive-deb-${{ env.GITHUB_SHA_SHORT }}
|
||||||
|
path: ./target/release/bundle/deb/spacedrive*.deb
|
||||||
|
|
||||||
|
- name: Publish artifacts (server)
|
||||||
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Spacedrive-server-${{ env.GITHUB_SHA_SHORT }}
|
||||||
|
path: ./target/release/server
|
||||||
|
|
||||||
- name: Publish artifacts (Windows)
|
- name: Publish artifacts (Windows)
|
||||||
if: matrix.platform == 'windows-latest'
|
if: matrix.platform == 'windows-latest'
|
10
.github/scripts/setup-system.ps1
vendored
Normal file
10
.github/scripts/setup-system.ps1
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Write-Host "This script is currently being used by CI and will need some more work before anyone can use it like the 'setup-system.sh' script for macOS and Linux!"
|
||||||
|
|
||||||
|
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
||||||
|
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
||||||
|
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z
|
||||||
|
7z x ffmpeg-release-full-shared.7z
|
||||||
|
mkdir ffmpeg
|
||||||
|
mv ffmpeg-*/* ffmpeg/
|
||||||
|
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
|
||||||
|
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
|
8
.github/scripts/setup-system.sh
vendored
8
.github/scripts/setup-system.sh
vendored
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
echo "Setting up your system for Spacedrive development!"
|
echo "Setting up your system for Spacedrive development!"
|
||||||
|
|
||||||
which cargo &> /dev/null
|
which cargo &> /dev/null
|
||||||
|
@ -20,9 +22,9 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev" # Tauri dependencies
|
DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev" # Tauri dependencies
|
||||||
DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies
|
DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies
|
||||||
DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive
|
DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive
|
||||||
|
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install $DEBIAN_TAURI_DEPS $DEBIAN_FFMPEG_DEPS $DEBIAN_BINDGEN_DEPS
|
sudo apt-get -y install ${CUSTOM_APT_FLAGS:-} $DEBIAN_TAURI_DEPS $DEBIAN_FFMPEG_DEPS $DEBIAN_BINDGEN_DEPS
|
||||||
elif which pacman &> /dev/null; then
|
elif which pacman &> /dev/null; then
|
||||||
echo "Detected 'pacman' based distro!"
|
echo "Detected 'pacman' based distro!"
|
||||||
ARCH_TAURI_DEPS="webkit2gtk base-devel curl wget openssl appmenu-gtk-module gtk3 libappindicator-gtk3 librsvg libvips" # Tauri deps https://tauri.studio/guides/getting-started/setup/linux#1-system-dependencies
|
ARCH_TAURI_DEPS="webkit2gtk base-devel curl wget openssl appmenu-gtk-module gtk3 libappindicator-gtk3 librsvg libvips" # Tauri deps https://tauri.studio/guides/getting-started/setup/linux#1-system-dependencies
|
||||||
|
@ -52,4 +54,4 @@ else
|
||||||
echo "Your OS '$OSTYPE' is not supported by this script. We would welcome a PR or some help adding your OS to this script. https://github.com/spacedriveapp/spacedrive/issues"
|
echo "Your OS '$OSTYPE' is not supported by this script. We would welcome a PR or some help adding your OS to this script. https://github.com/spacedriveapp/spacedrive/issues"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
fi
|
fi
|
249
.github/workflows/ci.yml
vendored
249
.github/workflows/ci.yml
vendored
|
@ -5,13 +5,13 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- new-ci
|
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**/.md'
|
- '**/.md'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: 1
|
CARGO_INCREMENTAL: 1
|
||||||
|
CUSTOM_APT_FLAGS: --no-install-recommends
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
typescript:
|
typescript:
|
||||||
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 17
|
node-version: 17
|
||||||
|
@ -30,142 +30,58 @@ jobs:
|
||||||
uses: pnpm/action-setup@v2.2.2
|
uses: pnpm/action-setup@v2.2.2
|
||||||
with:
|
with:
|
||||||
version: 7.x.x
|
version: 7.x.x
|
||||||
|
run_install: false
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Get pnpm store directory
|
||||||
run: pnpm i --frozen-lockfile
|
id: pnpm-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
name: Setup pnpm cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install pnpm dependencies
|
||||||
|
run: pnpm --frozen-lockfile i
|
||||||
|
|
||||||
- name: Perform typechecks
|
- name: Perform typechecks
|
||||||
run: pnpm typecheck
|
run: pnpm typecheck
|
||||||
|
|
||||||
build-js:
|
|
||||||
name: Build JS
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 17
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v2.2.2
|
|
||||||
with:
|
|
||||||
version: 7.x.x
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm i --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Build Desktop
|
|
||||||
run: pnpm desktop build
|
|
||||||
|
|
||||||
- name: Build Web
|
|
||||||
run: pnpm web build
|
|
||||||
|
|
||||||
build-core:
|
build-core:
|
||||||
name: Build Core (${{ matrix.platform }})
|
name: Build Core (${{ matrix.platform }})
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
|
needs: typescript
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install Node.js
|
||||||
uses: ./.github/actions/install-deps
|
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 17
|
node-version: 17
|
||||||
|
|
||||||
- name: Install Rust stable
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
components: rustfmt, rust-src
|
|
||||||
|
|
||||||
- name: Cache Rust Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1
|
|
||||||
with:
|
|
||||||
sharedKey: core-v1-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Generate Prisma client
|
|
||||||
working-directory: core
|
|
||||||
run: cargo run -p prisma-cli --release -- generate
|
|
||||||
|
|
||||||
- name: Build Core
|
|
||||||
run: cargo build -p sdcore --release
|
|
||||||
|
|
||||||
package-desktop:
|
|
||||||
name: Package desktop (${{ matrix.platform }})
|
|
||||||
runs-on: ${{ matrix.platform }}
|
|
||||||
needs: [typescript, build-js, build-core]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.github/actions/install-deps
|
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 17
|
|
||||||
|
|
||||||
- name: Install Rust stable
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
components: rustfmt, rust-src
|
|
||||||
|
|
||||||
- name: Cache Rust Dependencies
|
|
||||||
uses: Swatinem/rust-cache@v1
|
|
||||||
with:
|
|
||||||
sharedKey: core-v1-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2.2.2
|
uses: pnpm/action-setup@v2.0.1
|
||||||
with:
|
with:
|
||||||
version: 7.x.x
|
version: 7
|
||||||
|
run_install: false
|
||||||
- name: Install pnpm dependencies
|
|
||||||
run: pnpm i --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Build frontend
|
|
||||||
run: pnpm desktop build
|
|
||||||
|
|
||||||
- name: Generate Prisma client
|
|
||||||
working-directory: core
|
|
||||||
run: cargo run -p prisma-cli --release -- generate
|
|
||||||
|
|
||||||
- name: Bundle
|
|
||||||
run: pnpm desktop tauri build
|
|
||||||
|
|
||||||
- name: Publish artifacts
|
|
||||||
uses: ./.github/actions/publish-desktop-artifacts
|
|
||||||
|
|
||||||
build-server:
|
|
||||||
name: Build server
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-core
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
uses: ./.github/actions/install-deps
|
|
||||||
|
|
||||||
- name: Install Rust stable
|
- name: Install Rust stable
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -173,31 +89,96 @@ jobs:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
override: true
|
override: true
|
||||||
components: rustfmt, rust-src
|
components: rustfmt, rust-src
|
||||||
|
|
||||||
- name: Cache Rust Dependencies
|
- name: Cache Rust Dependencies
|
||||||
uses: Swatinem/rust-cache@v1
|
uses: Swatinem/rust-cache@v1
|
||||||
with:
|
with:
|
||||||
sharedKey: core-v1-${{ hashFiles('**/Cargo.lock') }}
|
sharedKey: core-v1-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Run 'setup-system.sh' script
|
||||||
|
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
|
||||||
|
run: ./.github/scripts/setup-system.sh
|
||||||
|
|
||||||
|
- name: Run 'setup-system.ps1' script
|
||||||
|
if: matrix.platform == 'windows-latest'
|
||||||
|
run: ./.github/scripts/setup-system.ps1
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
id: pnpm-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
name: Setup pnpm cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
- name: Install pnpm dependencies
|
||||||
|
run: pnpm --frozen-lockfile i
|
||||||
|
|
||||||
|
- name: Cache Prisma codegen
|
||||||
|
id: cache-prisma
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./core/src/prisma.rs
|
||||||
|
key: prisma-${{ hashFiles('./core/prisma/Cargo.toml', './core/prisma/schema.prisma', './core/prisma/src/main.rs') }}
|
||||||
|
|
||||||
- name: Generate Prisma client
|
- name: Generate Prisma client
|
||||||
working-directory: core
|
working-directory: core
|
||||||
run: cargo run -p prisma-cli --release -- generate
|
if: steps.cache-prisma.outputs.cache-hit != 'true'
|
||||||
|
run: cargo run --frozen --locked -p prisma-cli --release -- generate
|
||||||
|
|
||||||
- name: Build server image
|
- name: Cargo fetch
|
||||||
uses: ./.github/actions/build-server-image
|
run: cargo fetch --frozen
|
||||||
with:
|
|
||||||
gh_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
deploy-server:
|
- name: Check Core
|
||||||
name: Deploy Server
|
run: cargo check --frozen --offline -p sdcore --release
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-server
|
- name: Bundle Desktop
|
||||||
if: github.event_name != 'pull_request'
|
run: pnpm desktop tauri build
|
||||||
steps:
|
|
||||||
- name: Deploy Spacedrive Server to Kubernetes
|
- name: Build Server
|
||||||
env:
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
K8S_KUBECONFIG: ${{ secrets.K8S_KUBECONFIG }}
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.kube
|
cargo build --frozen --offline -p server --release
|
||||||
echo "$K8S_KUBECONFIG" > ~/.kube/config 2>&1
|
cp ./target/release/server ./apps/server/server
|
||||||
kubectl rollout restart deployment/sdserver-deployment
|
|
||||||
|
- name: Determine image name & tag
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
|
||||||
|
run: |
|
||||||
|
if [ "$GITHUB_EVENT_NAME" == "release" ]; then
|
||||||
|
export IMAGE_TAG=${GITHUB_REF##*/}
|
||||||
|
else
|
||||||
|
export IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
|
fi
|
||||||
|
export GITHUB_REPOSITORY_LOWER=$(echo $GITHUB_REPOSITORY | awk '{print tolower($0)}')
|
||||||
|
export IMAGE_NAME="ghcr.io/$GITHUB_REPOSITORY_LOWER/server"
|
||||||
|
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
||||||
|
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
|
||||||
|
echo "Building $IMAGE_NAME:$IMAGE_TAG"
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
|
||||||
|
run: |
|
||||||
|
docker build ./apps/server --tag $IMAGE_NAME:$IMAGE_TAG
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
|
||||||
|
run: |
|
||||||
|
docker push $IMAGE_NAME:$IMAGE_TAG
|
||||||
|
|
||||||
|
- name: Tag & push image as latest staging image
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request' && github.event_name != 'release'
|
||||||
|
run: |
|
||||||
|
docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:staging
|
||||||
|
docker push $IMAGE_NAME:staging
|
||||||
|
|
||||||
|
- name: Tag & push image as latest production image
|
||||||
|
if: matrix.platform == 'ubuntu-latest' && github.event_name == 'release'
|
||||||
|
run: |
|
||||||
|
docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:production
|
||||||
|
docker push $IMAGE_NAME:production
|
||||||
|
|
||||||
|
- name: Publish artifacts
|
||||||
|
uses: ./.github/actions/publish-artifacts
|
||||||
|
|
21
.github/workflows/clippy.yml
vendored
Normal file
21
.github/workflows/clippy.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
name: Rust Clippy check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**.rs'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
clippy_check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: rustup component add clippy
|
||||||
|
|
||||||
|
- uses: actions-rs/clippy-check@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
args: --all-features
|
|
@ -1,15 +1,18 @@
|
||||||
name: Create diagram
|
name: Create diagram
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
get_data:
|
get_data:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Update diagram
|
- name: Update diagram
|
||||||
uses: githubocto/repo-visualizer@main
|
uses: githubocto/repo-visualizer@main
|
||||||
with:
|
with:
|
|
@ -8,7 +8,7 @@ repository = "https://github.com/spacedriveapp/spacedrive"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
p2p = ["dep:libp2p"] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
|
p2p = [] # This feature controlls whether the Spacedrive Core contains the Peer to Peer syncing engine (It isn't required for the hosted core so we can disable it).
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hostname = "0.3.1"
|
hostname = "0.3.1"
|
||||||
|
@ -27,7 +27,6 @@ int-enum = "0.4.0"
|
||||||
ts-rs = { version = "6.1", features = ["chrono-impl"] }
|
ts-rs = { version = "6.1", features = ["chrono-impl"] }
|
||||||
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", tag = "0.5.0" }
|
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", tag = "0.5.0" }
|
||||||
walkdir = "^2.3.2"
|
walkdir = "^2.3.2"
|
||||||
libp2p = { version = "0.43.0", optional = true }
|
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
uuid = "0.8"
|
uuid = "0.8"
|
||||||
sysinfo = "0.23.9"
|
sysinfo = "0.23.9"
|
||||||
|
@ -39,6 +38,5 @@ include_dir = {version = "0.7.2", features = ["glob"]}
|
||||||
async-trait = "0.1.52"
|
async-trait = "0.1.52"
|
||||||
image = "0.24.1"
|
image = "0.24.1"
|
||||||
webp = "0.2.2"
|
webp = "0.2.2"
|
||||||
uhlc = "0.4.1"
|
|
||||||
ffmpeg-next = "5.0.3"
|
ffmpeg-next = "5.0.3"
|
||||||
fs_extra = "1.2.0"
|
fs_extra = "1.2.0"
|
|
@ -164,11 +164,6 @@ impl Node {
|
||||||
internal_channel,
|
internal_channel,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "p2p")]
|
|
||||||
tokio::spawn(async move {
|
|
||||||
p2p::listener::listen(None).await.unwrap_or(());
|
|
||||||
});
|
|
||||||
|
|
||||||
(node, event_recv)
|
(node, event_recv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 192 KiB |
Loading…
Reference in a new issue