Use cross in linux bundle workflow (#3950)
This commit is contained in:
@@ -15,6 +15,7 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
pull_request:
|
||||||
|
|
||||||
name: "Bundle Desktop (Linux)"
|
name: "Bundle Desktop (Linux)"
|
||||||
|
|
||||||
@@ -24,15 +25,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1) Check out source
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
|
||||||
with:
|
with:
|
||||||
# Only pass ref if it's explicitly set, otherwise let checkout action use its default behavior
|
ref: ${{ inputs.ref }}
|
||||||
ref: ${{ inputs.ref != '' && inputs.ref || '' }}
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# 2) Update versions before build
|
|
||||||
- name: Update versions
|
- name: Update versions
|
||||||
if: ${{ inputs.version != '' }}
|
if: ${{ inputs.version != '' }}
|
||||||
run: |
|
run: |
|
||||||
@@ -44,7 +42,6 @@ jobs:
|
|||||||
cd ui/desktop
|
cd ui/desktop
|
||||||
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
|
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
|
||||||
|
|
||||||
# 3) Debug information
|
|
||||||
- name: Debug workflow info
|
- name: Debug workflow info
|
||||||
env:
|
env:
|
||||||
WORKFLOW_NAME: ${{ github.workflow }}
|
WORKFLOW_NAME: ${{ github.workflow }}
|
||||||
@@ -63,7 +60,6 @@ jobs:
|
|||||||
lsb_release -a || true
|
lsb_release -a || true
|
||||||
df -h
|
df -h
|
||||||
|
|
||||||
# 4) Install system dependencies for Linux packaging
|
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@@ -83,7 +79,6 @@ jobs:
|
|||||||
dpkg-dev \
|
dpkg-dev \
|
||||||
protobuf-compiler
|
protobuf-compiler
|
||||||
|
|
||||||
# 4a) Pre-build cleanup to ensure enough disk space
|
|
||||||
- name: Pre-build cleanup
|
- name: Pre-build cleanup
|
||||||
run: |
|
run: |
|
||||||
echo "Performing aggressive pre-build cleanup..."
|
echo "Performing aggressive pre-build cleanup..."
|
||||||
@@ -104,52 +99,32 @@ jobs:
|
|||||||
# Check disk space after cleanup
|
# Check disk space after cleanup
|
||||||
df -h
|
df -h
|
||||||
|
|
||||||
# 5) Set up Rust
|
- name: Activate hermit and set CARGO_HOME
|
||||||
- name: Set up Rust
|
run: |
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # pin@v1
|
source bin/activate-hermit
|
||||||
with:
|
echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV
|
||||||
toolchain: stable
|
echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV
|
||||||
|
|
||||||
# 6) Set up Node.js
|
- name: Install cross
|
||||||
- name: Set up Node.js
|
run: source ./bin/activate-hermit && cargo install cross --git https://github.com/cross-rs/cross
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 23
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: ui/desktop/package-lock.json
|
|
||||||
|
|
||||||
# 7) Cache Rust dependencies
|
- name: Cache Cargo artifacts
|
||||||
- name: Cache Cargo registry
|
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # pin@v3
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: ~/.cargo/registry
|
path: |
|
||||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
${{ env.CARGO_HOME }}/bin/
|
||||||
|
${{ env.CARGO_HOME }}/registry/index/
|
||||||
|
${{ env.CARGO_HOME }}/registry/cache/
|
||||||
|
${{ env.CARGO_HOME }}/git/db/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-cargo-registry-
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
- name: Cache Cargo index
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/index
|
|
||||||
key: ${{ runner.os }}-cargo-index
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-cargo-index
|
|
||||||
|
|
||||||
- name: Cache Cargo build
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-cargo-build-
|
|
||||||
|
|
||||||
# 8) Set up Go for building temporal-service
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5
|
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
go-version: '1.21'
|
||||||
|
|
||||||
# 9) Build temporal-service using build.sh script
|
|
||||||
- name: Build temporal-service
|
- name: Build temporal-service
|
||||||
run: |
|
run: |
|
||||||
echo "Building temporal-service using build.sh script..."
|
echo "Building temporal-service using build.sh script..."
|
||||||
@@ -157,66 +132,41 @@ jobs:
|
|||||||
./build.sh
|
./build.sh
|
||||||
echo "temporal-service built successfully"
|
echo "temporal-service built successfully"
|
||||||
|
|
||||||
# 10) Build the Rust goosed binary
|
|
||||||
- name: Build goosed binary
|
- name: Build goosed binary
|
||||||
|
env:
|
||||||
|
CROSS_NO_WARNINGS: 0
|
||||||
|
RUST_LOG: debug
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
CROSS_VERBOSE: 1
|
||||||
run: |
|
run: |
|
||||||
echo "Building goosed binary for Linux..."
|
source ./bin/activate-hermit
|
||||||
cargo build --release -p goose-server
|
export TARGET="x86_64-unknown-linux-gnu"
|
||||||
ls -la target/release/
|
rustup target add "${TARGET}"
|
||||||
file target/release/goosed
|
cross build --release --target ${TARGET} -p goose-server
|
||||||
|
|
||||||
# 11) Clean up build artifacts to save space
|
|
||||||
- name: Clean up build artifacts
|
|
||||||
run: |
|
|
||||||
echo "Cleaning up to save disk space..."
|
|
||||||
# Remove debug artifacts
|
|
||||||
rm -rf target/debug || true
|
|
||||||
# Remove incremental build files
|
|
||||||
rm -rf target/release/incremental || true
|
|
||||||
rm -rf target/release/deps || true
|
|
||||||
rm -rf target/release/build || true
|
|
||||||
# Remove other target directories that aren't needed
|
|
||||||
find target -name "*.rlib" -delete || true
|
|
||||||
find target -name "*.rmeta" -delete || true
|
|
||||||
# Don't run cargo clean as it will remove our binary
|
|
||||||
# Check disk space
|
|
||||||
df -h
|
|
||||||
|
|
||||||
# 12) Copy binaries to Electron folder
|
|
||||||
- name: Copy binaries into Electron folder
|
- name: Copy binaries into Electron folder
|
||||||
run: |
|
run: |
|
||||||
echo "Copying binaries to ui/desktop/src/bin/"
|
echo "Copying binaries to ui/desktop/src/bin/"
|
||||||
|
export TARGET="x86_64-unknown-linux-gnu"
|
||||||
mkdir -p ui/desktop/src/bin
|
mkdir -p ui/desktop/src/bin
|
||||||
cp target/release/goosed ui/desktop/src/bin/
|
cp target/$TARGET/release/goosed ui/desktop/src/bin/
|
||||||
cp temporal-service/temporal-service ui/desktop/src/bin/
|
cp temporal-service/temporal-service ui/desktop/src/bin/
|
||||||
chmod +x ui/desktop/src/bin/goosed
|
chmod +x ui/desktop/src/bin/goosed
|
||||||
chmod +x ui/desktop/src/bin/temporal-service
|
chmod +x ui/desktop/src/bin/temporal-service
|
||||||
ls -la ui/desktop/src/bin/
|
ls -la ui/desktop/src/bin/
|
||||||
|
|
||||||
# 13) Final cleanup before npm build
|
|
||||||
- name: Final cleanup before npm build
|
|
||||||
run: |
|
|
||||||
echo "Final cleanup before npm build..."
|
|
||||||
# Now we can remove the entire target directory since we copied the binary
|
|
||||||
rm -rf target || true
|
|
||||||
# Clean any remaining caches
|
|
||||||
rm -rf ~/.cargo/registry/cache || true
|
|
||||||
rm -rf ~/.cargo/git/db || true
|
|
||||||
# Check final disk space
|
|
||||||
df -h
|
|
||||||
|
|
||||||
# 14) Install npm dependencies
|
|
||||||
- name: Install npm dependencies
|
- name: Install npm dependencies
|
||||||
run: |
|
run: |
|
||||||
|
source ./bin/activate-hermit
|
||||||
cd ui/desktop
|
cd ui/desktop
|
||||||
npm cache clean --force || true
|
npm cache clean --force || true
|
||||||
npm install
|
npm install
|
||||||
# Verify installation
|
# Verify installation
|
||||||
ls -la node_modules/.bin/ | head -5
|
ls -la node_modules/.bin/ | head -5
|
||||||
|
|
||||||
# 15) Build Electron app with Linux makers (.deb and .rpm)
|
|
||||||
- name: Build Linux packages
|
- name: Build Linux packages
|
||||||
run: |
|
run: |
|
||||||
|
source ./bin/activate-hermit
|
||||||
cd ui/desktop
|
cd ui/desktop
|
||||||
echo "Building Linux packages (.deb and .rpm)..."
|
echo "Building Linux packages (.deb and .rpm)..."
|
||||||
|
|
||||||
@@ -227,7 +177,6 @@ jobs:
|
|||||||
ls -la out/
|
ls -la out/
|
||||||
find out/ -name "*.deb" -o -name "*.rpm" | head -10
|
find out/ -name "*.deb" -o -name "*.rpm" | head -10
|
||||||
|
|
||||||
# 16) List all generated files for debugging
|
|
||||||
- name: List generated files
|
- name: List generated files
|
||||||
run: |
|
run: |
|
||||||
echo "=== All files in out/ directory ==="
|
echo "=== All files in out/ directory ==="
|
||||||
@@ -239,7 +188,6 @@ jobs:
|
|||||||
echo "=== File sizes ==="
|
echo "=== File sizes ==="
|
||||||
find ui/desktop/out/ -name "*.deb" -o -name "*.rpm" -exec ls -lh {} \;
|
find ui/desktop/out/ -name "*.deb" -o -name "*.rpm" -exec ls -lh {} \;
|
||||||
|
|
||||||
# 17) Upload .deb package
|
|
||||||
- name: Upload .deb package
|
- name: Upload .deb package
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -247,7 +195,6 @@ jobs:
|
|||||||
path: ui/desktop/out/make/deb/x64/*.deb
|
path: ui/desktop/out/make/deb/x64/*.deb
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
# 18) Upload .rpm package
|
|
||||||
- name: Upload .rpm package
|
- name: Upload .rpm package
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -255,7 +202,6 @@ jobs:
|
|||||||
path: ui/desktop/out/make/rpm/x64/*.rpm
|
path: ui/desktop/out/make/rpm/x64/*.rpm
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
# 19) Create combined artifact with both packages
|
|
||||||
- name: Upload combined Linux packages
|
- name: Upload combined Linux packages
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user