name: Weekly release build on: schedule: - cron: "0 2 * * 0" workflow_dispatch: inputs: audit: description: Run desktop size and performance audit before publishing type: boolean default: true push: branches: - main - 'ci/release-size-*' pull_request: branches: - main permissions: contents: read env: CARGO_TERM_COLOR: always <<<<<<< Updated upstream ======= # Pushes and PRs build packages only; scheduled releases always run the audit. RUN_RELEASE_AUDIT: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.audit) }} # Software adapters make the headless frame benchmark available on both hosts. CHITIN_BENCH_SOFTWARE_GPU: '1' RAYON_NUM_THREADS: '2' LP_NUM_THREADS: '2' >>>>>>> Stashed changes jobs: build: name: Release build (${{ matrix.target }}) runs-on: ${{ matrix.os }} env: # A unique directory prevents cached samples from satisfying a later run. CRITERION_HOME: ${{ github.workspace }}/target/release-audit/criterion-${{ github.run_id }}-${{ github.run_attempt }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest target: linux-x86_64 archive: chitin-linux-x86_64 desktop_executable: chitin-desktop cli_executable: chitin - os: windows-latest target: windows-x86_64 archive: chitin-windows-x86_64 desktop_executable: chitin-desktop.exe cli_executable: chitin.exe steps: - name: Checkout uses: actions/checkout@v4 - name: Install just uses: taiki-e/install-action@just - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Install Linux system dependencies if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y \ pkg-config \ libfontconfig1-dev \ libx11-dev \ libxkbcommon-dev \ libxkbcommon-x11-dev \ libxcursor-dev \ libxi-dev \ libxrandr-dev \ mesa-vulkan-drivers - name: Cache Cargo artifacts uses: Swatinem/rust-cache@v2 with: cache-on-failure: true <<<<<<< Updated upstream - name: Build desktop release ======= - name: Build stripped desktop reference if: env.RUN_RELEASE_AUDIT == 'true' run: cargo build -p chitin-desktop --release --locked - name: Build optimized desktop release >>>>>>> Stashed changes run: just build-desktop-release - name: Build CLI release run: just build-cli-release <<<<<<< Updated upstream ======= # Cargo builds package binaries for benches too, enabling dev-dependency # features. Never measure or ship a binary that those builds overwrite. - name: Freeze production executables shell: bash run: | mkdir -p target/release-frozen/baseline target/release-frozen/optimized target/release-audit cp target/release-size/${{ matrix.desktop_executable }} target/release-frozen/optimized/ cp target/release/${{ matrix.cli_executable }} target/release-frozen/optimized/ - name: Freeze audit reference and record executable sizes if: env.RUN_RELEASE_AUDIT == 'true' shell: bash run: | cp target/release/${{ matrix.desktop_executable }} target/release-frozen/baseline/ wc -c target/release-frozen/baseline/${{ matrix.desktop_executable }} \ target/release-frozen/optimized/${{ matrix.desktop_executable }} \ | tee target/release-audit/executable-bytes.txt - name: Check release audit tests if: env.RUN_RELEASE_AUDIT == 'true' run: cargo test -p chitin-release-audit --locked - name: Check optimized scientific and renderer tests run: cargo test -p chitin-bio -p chitin-molecule-renderer --lib --profile release-size --locked - name: Prebuild and measure order-balanced profiles if: env.RUN_RELEASE_AUDIT == 'true' run: just benchmark-release-profiles - name: Enforce desktop size and performance budgets if: env.RUN_RELEASE_AUDIT == 'true' shell: bash run: | cargo run -p chitin-release-audit --locked -- --paired \ "$CRITERION_HOME" baseline optimized \ target/release-frozen/baseline/${{ matrix.desktop_executable }} \ target/release-frozen/optimized/${{ matrix.desktop_executable }} \ target/release-audit/comparison.json >> "$GITHUB_STEP_SUMMARY" - name: Upload release measurements if: always() && env.RUN_RELEASE_AUDIT == 'true' uses: actions/upload-artifact@v4 with: name: release-audit-${{ matrix.target }} path: target/release-audit/ if-no-files-found: warn >>>>>>> Stashed changes - name: Package Linux executable if: runner.os == 'Linux' run: | mkdir -p dist/${{ matrix.archive }} cp target/release-frozen/optimized/chitin-desktop dist/${{ matrix.archive }}/chitin-desktop cp target/release-frozen/optimized/chitin dist/${{ matrix.archive }}/chitin cp README.md LICENSE dist/${{ matrix.archive }}/ tar -C dist -czf dist/${{ matrix.archive }}.tar.gz ${{ matrix.archive }} sha256sum dist/${{ matrix.archive }}.tar.gz > dist/${{ matrix.archive }}.sha256 - name: Package Windows executable if: runner.os == 'Windows' shell: pwsh run: | New-Item -ItemType Directory -Force -Path dist/${{ matrix.archive }} Copy-Item target/release-frozen/optimized/chitin-desktop.exe dist/${{ matrix.archive }}/chitin-desktop.exe Copy-Item target/release-frozen/optimized/chitin.exe dist/${{ matrix.archive }}/chitin.exe Copy-Item README.md,LICENSE dist/${{ matrix.archive }}/ Compress-Archive -Path dist/${{ matrix.archive }} -DestinationPath dist/${{ matrix.archive }}.zip -Force $hash = (Get-FileHash dist/${{ matrix.archive }}.zip -Algorithm SHA256).Hash.ToLower() "$hash ${{ matrix.archive }}.zip" | Out-File -Encoding ascii dist/${{ matrix.archive }}.sha256 - name: Upload release executable uses: actions/upload-artifact@v4 with: name: chitin-${{ matrix.target }} path: dist/* if-no-files-found: error release: name: Publish weekly prerelease if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' needs: build runs-on: ubuntu-latest permissions: contents: write concurrency: group: weekly-release cancel-in-progress: false steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download release executables uses: actions/download-artifact@v4 with: pattern: chitin-* merge-multiple: true path: release - name: Update weekly tag run: | git tag --force weekly "$GITHUB_SHA" git push origin --force refs/tags/weekly - name: Publish weekly prerelease uses: softprops/action-gh-release@v2 with: tag_name: weekly name: Weekly build prerelease: true make_latest: false body: | Automated weekly build for commit ${{ github.sha }}. files: | release/chitin-linux-x86_64.tar.gz release/chitin-linux-x86_64.sha256 release/chitin-windows-x86_64.zip release/chitin-windows-x86_64.sha256 fail_on_unmatched_files: true