返回 CodeWhale
nightly.yml
根目录 / .github / workflows / nightly.yml
1 name: Nightly
2
3 # Scheduled nightly artifact build. This used to run on every push to main,
4 # rebuilding six release targets per merge; PR CI already builds/tests the
5 # same commits on macOS/Windows and CNB covers Linux, so a daily cadence
6 # keeps the artifact stream fresh without burning ~28 runner-minutes per
7 # merge. Use workflow_dispatch for an on-demand build.
8 on:
9 schedule:
10 - cron: '17 9 * * *'
11 workflow_dispatch:
12
13 permissions:
14 contents: read
15
16 concurrency:
17 group: nightly-${{ github.ref }}
18 cancel-in-progress: true
19
20 env:
21 CARGO_TERM_COLOR: always
22 CARGO_INCREMENTAL: 0
23 RUSTFLAGS: -Dwarnings
24 DEEPSEEK_BUILD_SHA: ${{ github.sha }}
25
26 jobs:
27 build:
28 name: Build ${{ matrix.platform }}
29 strategy:
30 fail-fast: false
31 matrix:
32 include:
33 - os: ubuntu-latest
34 target: x86_64-unknown-linux-gnu
35 platform: linux-x64
36 cli_binary: codewhale
37 shim_binary: codew
38 tui_binary: codewhale-tui
39 cli_artifact: codewhale-linux-x64
40 tui_artifact: codewhale-tui-linux-x64
41 - os: ubuntu-24.04-arm
42 target: aarch64-unknown-linux-gnu
43 platform: linux-arm64
44 cli_binary: codewhale
45 shim_binary: codew
46 tui_binary: codewhale-tui
47 cli_artifact: codewhale-linux-arm64
48 tui_artifact: codewhale-tui-linux-arm64
49 - os: macos-latest
50 target: x86_64-apple-darwin
51 platform: macos-x64
52 cli_binary: codewhale
53 shim_binary: codew
54 tui_binary: codewhale-tui
55 cli_artifact: codewhale-macos-x64
56 tui_artifact: codewhale-tui-macos-x64
57 - os: macos-latest
58 target: aarch64-apple-darwin
59 platform: macos-arm64
60 cli_binary: codewhale
61 shim_binary: codew
62 tui_binary: codewhale-tui
63 cli_artifact: codewhale-macos-arm64
64 tui_artifact: codewhale-tui-macos-arm64
65 - os: windows-latest
66 target: x86_64-pc-windows-msvc
67 platform: windows-x64
68 cli_binary: codewhale.exe
69 shim_binary: codew.exe
70 tui_binary: codewhale-tui.exe
71 cli_artifact: codewhale-windows-x64.exe
72 tui_artifact: codewhale-tui-windows-x64.exe
73 - os: windows-11-arm
74 target: aarch64-pc-windows-msvc
75 platform: windows-arm64
76 cli_binary: codewhale.exe
77 shim_binary: codew.exe
78 tui_binary: codewhale-tui.exe
79 cli_artifact: codewhale-windows-arm64.exe
80 tui_artifact: codewhale-tui-windows-arm64.exe
81 runs-on: ${{ matrix.os }}
82 steps:
83 - uses: actions/checkout@v7
84 - uses: dtolnay/rust-toolchain@master
85 with:
86 toolchain: stable
87 targets: ${{ matrix.target }}
88 - uses: mozilla-actions/sccache-action@v0.0.10
89 id: sccache
90 continue-on-error: true
91 - name: Enable sccache
92 if: steps.sccache.outcome == 'success'
93 shell: bash
94 run: |
95 echo "SCCACHE_GHA_ENABLED=true" >> "${GITHUB_ENV}"
96 echo "RUSTC_WRAPPER=sccache" >> "${GITHUB_ENV}"
97 echo "SCCACHE_IGNORE_SERVER_IO_ERROR=1" >> "${GITHUB_ENV}"
98 - uses: Swatinem/rust-cache@v2
99 with:
100 cache-bin: false
101 - name: Install Linux system dependencies
102 if: runner.os == 'Linux'
103 run: |
104 for i in 1 2 3 4 5; do
105 sudo apt-get update && break
106 echo "apt-get update failed (attempt $i); retrying in 15s"
107 sleep 15
108 done
109 sudo apt-get install -y libdbus-1-dev pkg-config
110 - name: Build
111 shell: bash
112 # Nightly artifacts are disposable smoke binaries (14-day retention),
113 # so skip fat LTO + codegen-units=1; tagged releases keep the full
114 # optimized profile via the Release workflow.
115 env:
116 CARGO_PROFILE_RELEASE_LTO: 'off'
117 CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '16'
118 run: |
119 for attempt in 1 2 3; do
120 if cargo build --release --locked --target ${{ matrix.target }} -p codewhale-cli -p codewhale-tui; then
121 exit 0
122 fi
123 if [ "${attempt}" -lt 3 ]; then
124 echo "Build attempt ${attempt} failed; retrying in 30s..."
125 sleep 30
126 fi
127 done
128 echo "Build failed after 3 attempts" >&2
129 exit 1
130 - name: Smoke native ARM binaries
131 if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-pc-windows-msvc'
132 shell: bash
133 run: |
134 bin_dir="target/${{ matrix.target }}/release"
135 "${bin_dir}/${{ matrix.cli_binary }}" --version
136 "${bin_dir}/${{ matrix.shim_binary }}" --version
137 "${bin_dir}/${{ matrix.tui_binary }}" --version
138 - name: Stage artifact
139 id: stage
140 shell: bash
141 run: |
142 short_sha="${GITHUB_SHA::12}"
143 stage_one() {
144 local binary="$1"
145 local artifact="$2"
146 local dir="$3"
147 local bin_path="target/${{ matrix.target }}/release/${binary}"
148 if [ ! -f "${bin_path}" ]; then
149 echo "Binary not at ${bin_path}; searching target/ for ${binary}:"
150 find target -name "${binary}" -type f
151 exit 1
152 fi
153
154 mkdir -p "${dir}"
155 cp "${bin_path}" "${dir}/${artifact}"
156 cat > "${dir}/nightly-build-info.txt" <<INFO
157 repository=${GITHUB_REPOSITORY}
158 ref=${GITHUB_REF_NAME}
159 commit=${GITHUB_SHA}
160 artifact=${artifact}
161 profile=release-nightly-no-lto
162 INFO
163 }
164
165 stage_one "${{ matrix.cli_binary }}" "${{ matrix.cli_artifact }}" nightly-cli
166 stage_one "${{ matrix.tui_binary }}" "${{ matrix.tui_artifact }}" nightly-tui
167 echo "cli_name=${{ matrix.cli_artifact }}-${short_sha}" >> "${GITHUB_OUTPUT}"
168 echo "tui_name=${{ matrix.tui_artifact }}-${short_sha}" >> "${GITHUB_OUTPUT}"
169 - uses: actions/upload-artifact@v7
170 with:
171 name: ${{ steps.stage.outputs.cli_name }}
172 path: nightly-cli/*
173 retention-days: 14
174 - uses: actions/upload-artifact@v7
175 with:
176 name: ${{ steps.stage.outputs.tui_name }}
177 path: nightly-tui/*
178 retention-days: 14
179
179 lines YAML