-
Notifications
You must be signed in to change notification settings - Fork 32
154 lines (134 loc) · 5.08 KB
/
Copy pathbuild.yml
File metadata and controls
154 lines (134 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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