Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update github action workflows (release, ci) #633

Merged
merged 42 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9b901a0
combine the two CI workflows into a single one, skip docs dir
salman1993 Jan 16, 2025
7d6d6e6
combine CLI and Desktop App into a single release.yml
salman1993 Jan 16, 2025
b0ce8e0
add back some comments
salman1993 Jan 16, 2025
ce353f8
add special test tag pattern
salman1993 Jan 16, 2025
640b40c
add TODOs only for testing
salman1993 Jan 16, 2025
30f1aa4
fix indentation
salman1993 Jan 16, 2025
e546021
try to build without cross
salman1993 Jan 16, 2025
8031ae8
bring back cross, install as a separate step
salman1993 Jan 16, 2025
2d06b84
dont have conditional on the macos-cert step, or else npm run bundle …
salman1993 Jan 16, 2025
08f337e
again lets try without cross
salman1993 Jan 17, 2025
c3c2242
forgot to remove cross in build step
salman1993 Jan 17, 2025
63e766c
add libdbus-1-dev system library
salman1993 Jan 17, 2025
da1daef
separate installation process linux arm vs amd
salman1993 Jan 17, 2025
b1cf8ad
try to make it work for ubuntu aarch64
salman1993 Jan 17, 2025
1cb95e4
try adding target on setup rust - actions-rs/toolchain@v1
salman1993 Jan 17, 2025
1f6a46a
use ubuntu-22.04 instead of ubuntu-latest which run 24.x
salman1993 Jan 17, 2025
c086a51
Revert "use ubuntu-22.04 instead of ubuntu-latest which run 24.x"
salman1993 Jan 17, 2025
15facb6
skip ubuntu-latest, aarch64 builds for now, add in stable draft release
salman1993 Jan 17, 2025
a9b434d
ci: try adding back linux arm64
kalvinnchau Jan 17, 2025
c0fbacd
ci: use file in /etc/os-release for codename
kalvinnchau Jan 17, 2025
774bc59
ci: use deb822 sources for ubuntu24
kalvinnchau Jan 17, 2025
8c4731c
ci: fix bash script
kalvinnchau Jan 17, 2025
5ff918f
replace install rust toolchain command with a maintained github action
salman1993 Jan 17, 2025
f187310
use cross for building, update Cross.toml and release.yml
salman1993 Jan 17, 2025
72917ae
use pkg-config instead of pkg-config:arm64 in linux aarch64 cross target
salman1993 Jan 17, 2025
c02dce2
simplify release workflow, add a PR comment trigger for desktop app r…
salman1993 Jan 17, 2025
7014fc4
add canary release workflow
salman1993 Jan 17, 2025
d55f178
use github/[email protected] to gate the pr comment trigger
salman1993 Jan 17, 2025
3697d71
minor updates to pr-comment workflow
salman1993 Jan 17, 2025
1390d19
update download_cli script and workflows
salman1993 Jan 17, 2025
600e0ee
clean up download_cli.sh prints to console
salman1993 Jan 17, 2025
a1be1d8
standardize how we checkout code, setup rust, reuse bundle-desktop wo…
salman1993 Jan 17, 2025
7210643
fix typos
salman1993 Jan 17, 2025
f688068
reuseable workflows need to be at root, install-cli artifact
salman1993 Jan 17, 2025
f00c9f5
add job name for bundle-desktop reuse flow
salman1993 Jan 17, 2025
0184d3f
add reuseable workflow for build-cli
salman1993 Jan 17, 2025
3ea942a
install cross is failing for some reason
salman1993 Jan 17, 2025
fea5cd2
try using dtolnay/rust-toolchain@stable to setup rust
salman1993 Jan 17, 2025
75a5286
Use dtolnay/rust-toolchain@stable for all setup rust steps to be cons…
salman1993 Jan 17, 2025
baba004
Update usage string for download_cli.sh
salman1993 Jan 17, 2025
b85af2e
Remove extra step to find existing comment
salman1993 Jan 17, 2025
98c1419
Remove TODOs
salman1993 Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a **reuseable** workflow that bundles the Desktop App for macOS.
# It doesn't get triggered on its own. It gets used in multiple workflows:
# - release.yml
# - canary.yml
on:
workflow_call:
inputs:
# Let's allow overriding the OSes and architectures in JSON array form:
# e.g. '["ubuntu-latest","macos-latest"]'
# If no input is provided, these defaults apply.
operating-systems:
type: string
required: false
default: '["ubuntu-latest","macos-latest"]'
architectures:
type: string
required: false
default: '["x86_64","aarch64"]'

name: "Reusable workflow to build CLI"

jobs:
build-cli:
name: Build CLI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.operating-systems) }}
architecture: ${{ fromJson(inputs.architectures) }}
include:
- os: ubuntu-latest
target-suffix: unknown-linux-gnu
- os: macos-latest
target-suffix: apple-darwin

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.architecture }}-${{ matrix.target-suffix }}

- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Build CLI
env:
CROSS_NO_WARNINGS: 0
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
rustup target add "${TARGET}"

# 'cross' is used to cross-compile for different architectures (see Cross.toml)
cross build --release --target ${TARGET} -p goose-cli

# tar the goose binary as goose-<TARGET>.tar.bz2
cd target/${TARGET}/release
tar -cjf goose-${TARGET}.tar.bz2 goose
echo "ARTIFACT=target/${TARGET}/release/goose-${TARGET}.tar.bz2" >> $GITHUB_ENV

- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }}
path: ${{ env.ARTIFACT }}
141 changes: 141 additions & 0 deletions .github/workflows/bundle-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# This is a **reuseable** workflow that bundles the Desktop App for macOS.
# It doesn't get triggered on its own. It gets used in multiple workflows:
# - release.yml
# - canary.yml
# - pr-comment-bundle-desktop.yml
on:
workflow_call:
secrets:
CERTIFICATE_OSX_APPLICATION:
required: true
CERTIFICATE_PASSWORD:
required: true
APPLE_ID:
required: true
APPLE_ID_PASSWORD:
required: true
APPLE_TEAM_ID:
required: true

name: Reusable workflow to bundle desktop app

jobs:
bundle-desktop:
runs-on: macos-latest
name: Bundle Desktop App on macOS
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache Cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/index
key: ${{ runner.os }}-cargo-index
restore-keys: |
${{ runner.os }}-cargo-index

- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-

- name: Build goosed
run: cargo build --release -p goose-server

- name: Copy binary into Electron folder
run: cp target/release/goosed ui/desktop/src/bin/goosed

- name: Add MacOS certs for signing and notarization
run: ./add-macos-cert.sh
working-directory: ui/desktop
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'

- name: Install dependencies
run: npm ci
working-directory: ui/desktop

- name: Make default Goose App
run: |
attempt=0
max_attempts=2
until [ $attempt -ge $max_attempts ]; do
npm run bundle:default && break
attempt=$((attempt + 1))
echo "Attempt $attempt failed. Retrying..."
sleep 5
done
if [ $attempt -ge $max_attempts ]; then
echo "Action failed after $max_attempts attempts."
exit 1
fi
working-directory: ui/desktop
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

- name: Upload Desktop artifact
uses: actions/upload-artifact@v4
with:
name: Goose-darwin-arm64
path: ui/desktop/out/Goose-darwin-arm64/Goose.zip

- name: Quick launch test (macOS)
run: |
# Ensure no quarantine attributes (if needed)
xattr -cr "ui/desktop/out/Goose-darwin-arm64/Goose.app"
echo "Opening Goose.app..."
open -g "ui/desktop/out/Goose-darwin-arm64/Goose.app"

# Give the app a few seconds to start and write logs
sleep 5

# Check if it's running
if pgrep -f "Goose.app/Contents/MacOS/Goose" > /dev/null; then
echo "App appears to be running."
else
echo "App did not stay open. Possible crash or startup error."
exit 1
fi
LOGFILE="$HOME/Library/Application Support/Goose/logs/main.log"
# Print the log and verify "ChatWindow loaded" is in the logs
if [ -f "$LOGFILE" ]; then
echo "===== Log file contents ====="
cat "$LOGFILE"
echo "============================="
if grep -F "ChatWindow loaded" "$LOGFILE"; then
echo "Confirmed: 'ChatWindow loaded' found in logs!"
else
echo "Did not find 'ChatWindow loaded' in logs. Failing..."
exit 1
fi
else
echo "No log file found at $LOGFILE. Exiting with failure."
exit 1
fi
# Kill the app to clean up
pkill -f "Goose.app/Contents/MacOS/Goose"
80 changes: 80 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This workflow is for canary releases, automatically triggered by push to v1.0 branch.
# This workflow is identical to "release.yml" with these exceptions:
# - Triggered by push to v1.0 branch
# - Github Release tagged as "canary"
on:
push:
paths-ignore:
- 'docs/**'
branches:
- v1.0

name: Canary

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# ------------------------------------
# 1) Build CLI for multiple OS/Arch
# ------------------------------------
build-cli:
uses: ./.github/workflows/build-cli.yml

# ------------------------------------
# 2) Upload Install CLI Script (we only need to do this once)
# ------------------------------------
install-script:
name: Upload Install Script
runs-on: ubuntu-latest
needs: [ build-cli ]
steps:
- uses: actions/checkout@v4
- uses: actions/upload-artifact@v4
with:
name: download_cli.sh
path: download_cli.sh

# ------------------------------------------------------------
# 3) Bundle Desktop App (macOS only) - builds goosed and Electron app
# ------------------------------------------------------------
bundle-desktop:
uses: ./.github/workflows/bundle-desktop.yml
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

# ------------------------------------
# 4) Create/Update GitHub Release
# ------------------------------------
release:
name: Release
runs-on: ubuntu-latest
needs: [ build-cli, install-script, bundle-desktop ]
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

# Create/update the canary release
- name: Release canary
uses: ncipollo/release-action@v1
with:
tag: canary
name: Canary
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
goose-*.tar.bz2
Goose*.zip
download_cli.sh
allowUpdates: true
omitBody: true
omitPrereleaseDuringUpdate: true
30 changes: 0 additions & 30 deletions .github/workflows/ci-desktop.yml

This file was deleted.

Loading
Loading