mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-03-28 11:33:47 -04:00
Update Docker build and GitHub actions to always build core libs (#1404)
This commit is contained in:
27
.github/actions/build-android-app/action.yml
vendored
27
.github/actions/build-android-app/action.yml
vendored
@@ -17,12 +17,37 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: apps/mobile-app/package-lock.json
|
||||
|
||||
- name: Build core libraries
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Verify core library distribution
|
||||
shell: bash
|
||||
run: |
|
||||
TARGET_DIRS=(
|
||||
"apps/mobile-app/utils/dist/core/identity-generator"
|
||||
"apps/mobile-app/utils/dist/core/password-generator"
|
||||
"apps/mobile-app/utils/dist/core/models"
|
||||
"apps/mobile-app/utils/dist/core/vault"
|
||||
)
|
||||
for dir in "${TARGET_DIRS[@]}"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "Error: Directory $dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "Core library distribution verified"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
shell: bash
|
||||
|
||||
@@ -12,12 +12,44 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: apps/browser-extension/package-lock.json
|
||||
|
||||
- name: Setup Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: core/rust
|
||||
|
||||
- name: Install wasm-pack
|
||||
shell: bash
|
||||
run: cargo install wasm-pack --locked
|
||||
|
||||
- name: Build core libraries
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Verify core library distribution
|
||||
shell: bash
|
||||
run: |
|
||||
# Verify critical rust WASM files exist
|
||||
if [ ! -f "apps/browser-extension/src/utils/dist/core/rust/aliasvault_core_bg.wasm" ]; then
|
||||
echo "Error: Rust WASM files not found in browser extension"
|
||||
exit 1
|
||||
fi
|
||||
echo "Core library distribution verified"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
shell: bash
|
||||
|
||||
69
.github/actions/build-core-libraries/action.yml
vendored
Normal file
69
.github/actions/build-core-libraries/action.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: "Build Core Libraries"
|
||||
description: "Builds and distributes all core libraries including TypeScript packages and Rust WASM"
|
||||
inputs:
|
||||
working-directory:
|
||||
description: "Working directory (default: repository root)"
|
||||
required: false
|
||||
default: "."
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Setup Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Install wasm-pack
|
||||
shell: bash
|
||||
run: cargo install wasm-pack --locked
|
||||
|
||||
- name: Build and distribute core libraries
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Verify core library distribution
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: |
|
||||
# Check if files exist and were recently modified
|
||||
TARGET_DIRS=(
|
||||
"apps/browser-extension/src/utils/dist/core/identity-generator"
|
||||
"apps/browser-extension/src/utils/dist/core/password-generator"
|
||||
"apps/browser-extension/src/utils/dist/core/models"
|
||||
"apps/browser-extension/src/utils/dist/core/vault"
|
||||
"apps/browser-extension/src/utils/dist/core/rust"
|
||||
"apps/mobile-app/utils/dist/core/identity-generator"
|
||||
"apps/mobile-app/utils/dist/core/password-generator"
|
||||
"apps/mobile-app/utils/dist/core/models"
|
||||
"apps/mobile-app/utils/dist/core/vault"
|
||||
)
|
||||
|
||||
for dir in "${TARGET_DIRS[@]}"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "Warning: Directory $dir does not exist (may be expected for some builds)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if files were modified in the last 10 minutes
|
||||
find "$dir" -type f -mmin -10 | grep -q . || {
|
||||
echo "Warning: Files in $dir were not recently modified"
|
||||
}
|
||||
done
|
||||
|
||||
# Verify critical rust WASM files exist
|
||||
if [ ! -f "apps/browser-extension/src/utils/dist/core/rust/aliasvault_core_bg.wasm" ]; then
|
||||
echo "Error: Rust WASM files not found in browser extension"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Core library distribution verified"
|
||||
27
.github/actions/build-ios-app/action.yml
vendored
27
.github/actions/build-ios-app/action.yml
vendored
@@ -17,12 +17,37 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: apps/mobile-app/package-lock.json
|
||||
|
||||
- name: Build core libraries
|
||||
shell: bash
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Verify core library distribution
|
||||
shell: bash
|
||||
run: |
|
||||
TARGET_DIRS=(
|
||||
"apps/mobile-app/utils/dist/core/identity-generator"
|
||||
"apps/mobile-app/utils/dist/core/password-generator"
|
||||
"apps/mobile-app/utils/dist/core/models"
|
||||
"apps/mobile-app/utils/dist/core/vault"
|
||||
)
|
||||
for dir in "${TARGET_DIRS[@]}"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "Error: Directory $dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "Core library distribution verified"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
shell: bash
|
||||
|
||||
45
.github/workflows/browser-extension-build.yml
vendored
45
.github/workflows/browser-extension-build.yml
vendored
@@ -12,49 +12,16 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-shared-libraries:
|
||||
build-core-libraries:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Build and distribute core libraries
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Verify core library distribution
|
||||
run: |
|
||||
# Check if files exist and were recently modified
|
||||
TARGET_DIRS=(
|
||||
"apps/browser-extension/src/utils/dist/core/identity-generator"
|
||||
"apps/browser-extension/src/utils/dist/core/password-generator"
|
||||
"apps/browser-extension/src/utils/dist/core/models"
|
||||
"apps/browser-extension/src/utils/dist/core/vault"
|
||||
)
|
||||
|
||||
for dir in "${TARGET_DIRS[@]}"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "❌ Directory $dir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if files were modified in the last 5 minutes
|
||||
find "$dir" -type f -mmin -5 | grep -q . || {
|
||||
echo "❌ Files in $dir were not recently modified"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
echo "✅ Shared library distribution verified"
|
||||
- name: Build Core Libraries
|
||||
uses: ./.github/actions/build-core-libraries
|
||||
|
||||
build-chrome-extension:
|
||||
needs: build-shared-libraries
|
||||
needs: build-core-libraries
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -65,7 +32,7 @@ jobs:
|
||||
browser: chrome
|
||||
|
||||
build-firefox-extension:
|
||||
needs: build-shared-libraries
|
||||
needs: build-core-libraries
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -76,7 +43,7 @@ jobs:
|
||||
browser: firefox
|
||||
|
||||
build-edge-extension:
|
||||
needs: build-shared-libraries
|
||||
needs: build-core-libraries
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
40
.github/workflows/e2e-tests.yml
vendored
40
.github/workflows/e2e-tests.yml
vendored
@@ -105,7 +105,26 @@ jobs:
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Setup Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: core/rust
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: cargo install wasm-pack --locked
|
||||
|
||||
- name: Build core libraries
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Install .NET dependencies
|
||||
working-directory: apps/server
|
||||
run: dotnet workload install wasm-tools
|
||||
|
||||
@@ -158,6 +177,25 @@ jobs:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: apps/browser-extension/package-lock.json
|
||||
|
||||
- name: Setup Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: core/rust
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: cargo install wasm-pack --locked
|
||||
|
||||
- name: Build core libraries
|
||||
run: |
|
||||
cd ./core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Install .NET dependencies
|
||||
working-directory: apps/server
|
||||
run: dotnet workload install wasm-tools
|
||||
|
||||
6
.github/workflows/mobile-app-build.yml
vendored
6
.github/workflows/mobile-app-build.yml
vendored
@@ -99,6 +99,12 @@ jobs:
|
||||
cache: 'npm'
|
||||
cache-dependency-path: apps/mobile-app/package-lock.json
|
||||
|
||||
- name: Build core libraries
|
||||
run: |
|
||||
cd ../../core
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ------------------------------------------
|
||||
# Build core libraries if needed
|
||||
# ------------------------------------------
|
||||
|
||||
CORE_DIR="../../core"
|
||||
MOBILE_CORE_DIST="../utils/dist/core"
|
||||
|
||||
if [ ! -d "$MOBILE_CORE_DIST/models" ] || [ ! -d "$MOBILE_CORE_DIST/vault" ]; then
|
||||
echo "Building core libraries..."
|
||||
pushd "$CORE_DIR" > /dev/null
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
popd > /dev/null
|
||||
echo "Core libraries built successfully"
|
||||
fi
|
||||
|
||||
# ------------------------------------------
|
||||
# Build Android app in release mode
|
||||
# ------------------------------------------
|
||||
|
||||
./gradlew bundleRelease
|
||||
|
||||
# Open directory that should contain the .aab file if build was successful
|
||||
|
||||
@@ -12,6 +12,22 @@ EXPORT_PLIST="$PWD/exportOptions.plist"
|
||||
# Put the fastlane API key in the home directory
|
||||
API_KEY_PATH="$HOME/APPSTORE_CONNECT_FASTLANE.json"
|
||||
|
||||
# ------------------------------------------
|
||||
# Build core libraries if needed
|
||||
# ------------------------------------------
|
||||
|
||||
CORE_DIR="../../../core"
|
||||
MOBILE_CORE_DIST="../utils/dist/core"
|
||||
|
||||
if [ ! -d "$MOBILE_CORE_DIST/models" ] || [ ! -d "$MOBILE_CORE_DIST/vault" ]; then
|
||||
echo "Building core libraries..."
|
||||
pushd "$CORE_DIR" > /dev/null
|
||||
chmod +x build-and-distribute.sh
|
||||
./build-and-distribute.sh
|
||||
popd > /dev/null
|
||||
echo "Core libraries built successfully"
|
||||
fi
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
if [ ! -f "$API_KEY_PATH" ]; then
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||
WORKDIR /app
|
||||
|
||||
# ============================================
|
||||
# Stage: Build core libraries
|
||||
# ============================================
|
||||
FROM node:20-slim AS core-builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Copy core library source files
|
||||
COPY core/ ./core/
|
||||
|
||||
# Build core libraries
|
||||
RUN cd ./core && \
|
||||
chmod +x build-and-distribute.sh && \
|
||||
./build-and-distribute.sh
|
||||
|
||||
# ============================================
|
||||
# Stage: Build .NET application
|
||||
# ============================================
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
ARG TARGETARCH
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
@@ -21,6 +39,10 @@ RUN dotnet workload install wasm-tools
|
||||
# Copy all project files
|
||||
COPY apps/server /src
|
||||
|
||||
# Copy built core libraries from core-builder stage
|
||||
COPY --from=core-builder /src/core/ /src-core/
|
||||
RUN cp -r /src-core/apps/server/AliasVault.Client/wwwroot/js/dist/core/* /src/AliasVault.Client/wwwroot/js/dist/core/ 2>/dev/null || true
|
||||
|
||||
# Build the Client project
|
||||
WORKDIR "/src/AliasVault.Client"
|
||||
RUN dotnet build "AliasVault.Client.csproj" \
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
# Multi-stage build for AliasVault single container deployment
|
||||
|
||||
# ============================================
|
||||
# Stage 1: Build .NET applications
|
||||
# Stage 1: Build core libraries
|
||||
# ============================================
|
||||
FROM node:20-slim AS core-builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Copy core library source files
|
||||
COPY core/ ./core/
|
||||
|
||||
# Build core libraries
|
||||
RUN cd ./core && \
|
||||
chmod +x build-and-distribute.sh && \
|
||||
./build-and-distribute.sh
|
||||
|
||||
# ============================================
|
||||
# Stage 2: Build .NET applications
|
||||
# ============================================
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS dotnet-builder
|
||||
|
||||
@@ -16,6 +31,9 @@ WORKDIR /src
|
||||
COPY apps/server/ ./apps/server/
|
||||
COPY shared/ ./shared/
|
||||
|
||||
# Copy built core libraries from core-builder stage
|
||||
COPY --from=core-builder /src/core/ ./core/
|
||||
|
||||
# Install required .NET workloads and restore packages once for the entire solution
|
||||
WORKDIR /src/apps/server
|
||||
|
||||
@@ -56,7 +74,7 @@ RUN find /app -name "*.pdb" -delete && \
|
||||
find /app -name "web.config" -delete
|
||||
|
||||
# ============================================
|
||||
# Stage 2: Download s6-overlay separately
|
||||
# Stage 3: Download s6-overlay separately
|
||||
# ============================================
|
||||
FROM alpine:3.19 AS s6-downloader
|
||||
ARG S6_OVERLAY_VERSION=3.2.0.2
|
||||
@@ -69,7 +87,7 @@ RUN ARCH="${TARGETARCH}"; \
|
||||
mv s6-overlay-${ARCH}.tar.xz s6-overlay-arch.tar.xz
|
||||
|
||||
# ============================================
|
||||
# Stage 3: Final runtime image
|
||||
# Stage 4: Final runtime image
|
||||
# ============================================
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0-bookworm-slim
|
||||
|
||||
|
||||
Reference in New Issue
Block a user