Nightly #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nightly | |
| # Scheduled nightly artifact build. This used to run on every push to main, | |
| # rebuilding six release targets per merge; PR CI already builds/tests the | |
| # same commits on macOS/Windows and CNB covers Linux, so a daily cadence | |
| # keeps the artifact stream fresh without burning ~28 runner-minutes per | |
| # merge. Use workflow_dispatch for an on-demand build. | |
| on: | |
| schedule: | |
| - cron: '17 9 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: nightly-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| RUSTFLAGS: -Dwarnings | |
| DEEPSEEK_BUILD_SHA: ${{ github.sha }} | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| platform: linux-x64 | |
| binary: codewhale | |
| primary_artifact: codewhale-linux-x64 | |
| alias_artifact: codew-linux-x64 | |
| - os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| platform: linux-arm64 | |
| binary: codewhale | |
| primary_artifact: codewhale-linux-arm64 | |
| alias_artifact: codew-linux-arm64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| platform: macos-x64 | |
| binary: codewhale | |
| primary_artifact: codewhale-macos-x64 | |
| alias_artifact: codew-macos-x64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| platform: macos-arm64 | |
| binary: codewhale | |
| primary_artifact: codewhale-macos-arm64 | |
| alias_artifact: codew-macos-arm64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| platform: windows-x64 | |
| binary: codewhale.exe | |
| primary_artifact: codewhale-windows-x64.exe | |
| alias_artifact: codew-windows-x64.exe | |
| - os: windows-11-arm | |
| target: aarch64-pc-windows-msvc | |
| platform: windows-arm64 | |
| binary: codewhale.exe | |
| primary_artifact: codewhale-windows-arm64.exe | |
| alias_artifact: codew-windows-arm64.exe | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - uses: mozilla-actions/sccache-action@v0.0.10 | |
| id: sccache | |
| continue-on-error: true | |
| - name: Enable sccache | |
| if: steps.sccache.outcome == 'success' | |
| shell: bash | |
| run: | | |
| { | |
| echo "SCCACHE_GHA_ENABLED=true" | |
| echo "RUSTC_WRAPPER=sccache" | |
| echo "SCCACHE_IGNORE_SERVER_IO_ERROR=1" | |
| } >> "${GITHUB_ENV}" | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-bin: false | |
| - name: Install Linux system dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| for i in 1 2 3 4 5; do | |
| sudo apt-get update && break | |
| echo "apt-get update failed (attempt $i); retrying in 15s" | |
| sleep 15 | |
| done | |
| sudo apt-get install -y libdbus-1-dev pkg-config | |
| - name: Build | |
| shell: bash | |
| # Nightly artifacts are disposable smoke binaries (14-day retention), | |
| # so skip fat LTO + codegen-units=1; tagged releases keep the full | |
| # optimized profile via the Release workflow. | |
| env: | |
| CARGO_PROFILE_RELEASE_LTO: 'off' | |
| CARGO_PROFILE_RELEASE_CODEGEN_UNITS: '16' | |
| run: | | |
| for attempt in 1 2 3; do | |
| if cargo build --release --locked --target ${{ matrix.target }} -p codewhale-cli; then | |
| exit 0 | |
| fi | |
| if [ "${attempt}" -lt 3 ]; then | |
| echo "Build attempt ${attempt} failed; retrying in 30s..." | |
| sleep 30 | |
| fi | |
| done | |
| echo "Build failed after 3 attempts" >&2 | |
| exit 1 | |
| - name: Smoke binary on matching native runners | |
| if: >- | |
| (startsWith(matrix.target, 'x86_64-') && runner.arch == 'X64') || | |
| (startsWith(matrix.target, 'aarch64-') && runner.arch == 'ARM64') | |
| shell: bash | |
| run: | | |
| bin_dir="target/${{ matrix.target }}/release" | |
| "${bin_dir}/${{ matrix.binary }}" --version | |
| - name: Stage artifact | |
| id: stage | |
| shell: bash | |
| run: | | |
| short_sha="${GITHUB_SHA::12}" | |
| bin_path="target/${{ matrix.target }}/release/${{ matrix.binary }}" | |
| if [ ! -f "${bin_path}" ]; then | |
| echo "Binary not at ${bin_path}; searching target/ for ${{ matrix.binary }}:" | |
| find target -name "${{ matrix.binary }}" -type f | |
| exit 1 | |
| fi | |
| stage_copy() { | |
| local artifact="$1" | |
| local dir="$2" | |
| mkdir -p "${dir}" | |
| cp "${bin_path}" "${dir}/${artifact}" | |
| cat > "${dir}/nightly-build-info.txt" <<INFO | |
| repository=${GITHUB_REPOSITORY} | |
| ref=${GITHUB_REF_NAME} | |
| commit=${GITHUB_SHA} | |
| artifact=${artifact} | |
| profile=release-nightly-no-lto | |
| INFO | |
| } | |
| stage_copy "${{ matrix.primary_artifact }}" nightly-primary | |
| stage_copy "${{ matrix.alias_artifact }}" nightly-alias | |
| cmp -s \ | |
| "nightly-primary/${{ matrix.primary_artifact }}" \ | |
| "nightly-alias/${{ matrix.alias_artifact }}" | |
| echo "primary_name=${{ matrix.primary_artifact }}-${short_sha}" >> "${GITHUB_OUTPUT}" | |
| echo "alias_name=${{ matrix.alias_artifact }}-${short_sha}" >> "${GITHUB_OUTPUT}" | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ steps.stage.outputs.primary_name }} | |
| path: nightly-primary/* | |
| retention-days: 14 | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ steps.stage.outputs.alias_name }} | |
| path: nightly-alias/* | |
| retention-days: 14 |