Skip to content

Merge pull request #146 from stippi/feature/skills-phase2 #775

Merge pull request #146 from stippi/feature/skills-phase2

Merge pull request #146 from stippi/feature/skills-phase2 #775

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
test-linux:
name: Test workspace (Linux, excl. ui_gpui)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
components: rustfmt,clippy
cache-key: workspace-linux
cache-save-if: ${{ github.event_name != 'pull_request' }}
- name: cargo fmt --check
run: cargo fmt --all -- --check
# We exclude ui_gpui here because gpui is exercised separately on every
# supported platform in the `test-gpui` job. Linting / testing the rest
# of the workspace on Linux is sufficient.
- name: cargo clippy (workspace, excl. ui_gpui)
run: |
cargo clippy \
--workspace --exclude ui_gpui --all-targets --locked \
-- -D warnings
- name: cargo test (workspace, excl. ui_gpui)
run: cargo test --workspace --exclude ui_gpui --locked
test-gpui:
name: Test ui_gpui (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux-x86_64
- os: macos-latest
name: macos-aarch64
- os: windows-latest
name: windows-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
cache-key: ui-gpui-${{ matrix.name }}
cache-save-if: ${{ github.event_name != 'pull_request' }}
- name: cargo test -p ui_gpui
run: cargo test -p ui_gpui --locked
build:
needs: [test-linux, test-gpui]
# Skip the full release-build matrix for pull requests; running tests is
# enough to gate PRs and the cross-platform build matrix is expensive.
if: github.event_name != 'pull_request'
strategy:
fail-fast: false # Don't cancel other builds if one fails
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: linux-x86_64
extension: ""
- os: macos-latest
target: x86_64-apple-darwin
name: macos-x86_64
extension: ""
- os: macos-latest
target: aarch64-apple-darwin
name: macos-aarch64
extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
name: windows-x86_64
extension: ".exe"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
target: ${{ matrix.target }}
cache-key: build-${{ matrix.name }}
- name: Build
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: build
args: --locked --release --target ${{ matrix.target }}
- name: Package Binary
shell: bash
run: |
mkdir -p release
cp "target/${{ matrix.target }}/release/code-assistant${{ matrix.extension }}" release/
cd release
# Windows runner has no 'zip' installed
if [ "${{ matrix.os }}" = "windows-latest" ]; then
# PowerShell Compress-Archive instead of zip
powershell -Command "Compress-Archive -Path ./code-assistant${{ matrix.extension }} -DestinationPath ./code-assistant-${{ matrix.name }}.zip"
else
# Linux/macOS: standard zip
zip code-assistant-${{ matrix.name }}.zip "code-assistant${{ matrix.extension }}"
fi
- name: Build macOS .app bundle
if: matrix.os == 'macos-latest'
shell: bash
run: |
case "${{ matrix.target }}" in
aarch64-apple-darwin) ARCH="aarch64" ;;
x86_64-apple-darwin) ARCH="x86_64" ;;
*) echo "unknown macOS target: ${{ matrix.target }}"; exit 1 ;;
esac
./scripts/bundle-macos.sh --no-build "$ARCH"
# Pick up the produced bundle zip without depending on the version
# in the filename (it can change between commits).
mkdir -p release
mv target/macos-bundle/Code-Assistant-*-"$ARCH".zip \
"release/Code-Assistant-${{ matrix.name }}.app.zip"
- name: Upload Nightly Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: code-assistant-${{ matrix.name }}
path: release/code-assistant-${{ matrix.name }}.zip
retention-days: 30
- name: Upload Nightly App Bundle
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Code-Assistant-${{ matrix.name }}-app
path: release/Code-Assistant-${{ matrix.name }}.app.zip
retention-days: 30