···11+# This file was autogenerated by dist: https://github.com/astral-sh/cargo-dist
22+#
13# Copyright 2022-2024, axodotdev
44+# Copyright 2025 Astral Software Inc.
25# SPDX-License-Identifier: MIT or Apache-2.0
36#
47# CI that:
58#
69# * checks for a Git Tag that looks like a release
77-# * builds artifacts with cargo-dist (archives, installers, hashes)
1010+# * builds artifacts with dist (archives, installers, hashes)
811# * uploads those artifacts to temporary workflow zip
912# * on success, uploads the artifacts to a GitHub Release
1013#
···1215# title/body based on your changelogs.
13161417name: Release
1515-1618permissions:
1717- contents: write
1919+ "contents": "write"
18201921# This task will run whenever you push a git tag that looks like a version
2022# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
···2325# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2426#
2527# If PACKAGE_NAME is specified, then the announcement will be for that
2626-# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
2828+# package (erroring out if it doesn't have the given version or isn't dist-able).
2729#
2830# If PACKAGE_NAME isn't specified, then the announcement will be for all
2929-# (cargo-dist-able) packages in the workspace with that version (this mode is
3131+# (dist-able) packages in the workspace with that version (this mode is
3032# intended for workspaces with only one dist-able package, or with all dist-able
3133# packages versioned/released in lockstep).
3234#
···3840# If there's a prerelease-style suffix to the version, then the release(s)
3941# will be marked as a prerelease.
4042on:
4343+ pull_request:
4144 push:
4245 tags:
4346 - '**[0-9]+.[0-9]+.[0-9]+*'
4444- pull_request:
45474648jobs:
4747- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
4949+ # Run 'dist plan' (or host) to determine what tasks we need to do
4850 plan:
4949- runs-on: ubuntu-latest
5151+ runs-on: "ubuntu-22.04"
5052 outputs:
5153 val: ${{ steps.plan.outputs.manifest }}
5254 tag: ${{ !github.event.pull_request && github.ref_name || '' }}
···5759 steps:
5860 - uses: actions/checkout@v4
5961 with:
6262+ persist-credentials: false
6063 submodules: recursive
6161- - name: Install cargo-dist
6464+ - name: Install dist
6265 # we specify bash to get pipefail; it guards against the `curl` command
6366 # failing. otherwise `sh` won't catch that `curl` returned non-0
6467 shell: bash
6565- run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.3/cargo-dist-installer.sh | sh"
6868+ run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/cargo-dist/releases/download/v0.28.4/cargo-dist-installer.sh | sh"
6969+ - name: Cache dist
7070+ uses: actions/upload-artifact@v4
7171+ with:
7272+ name: cargo-dist-cache
7373+ path: ~/.cargo/bin/dist
6674 # sure would be cool if github gave us proper conditionals...
6775 # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
6876 # functionality based on whether this is a pull_request, and whether it's from a fork.
···7078 # but also really annoying to build CI around when it needs secrets to work right.)
7179 - id: plan
7280 run: |
7373- cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
7474- echo "cargo dist ran successfully"
8181+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
8282+ echo "dist ran successfully"
7583 cat plan-dist-manifest.json
7684 echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
7785 - name: "Upload dist-manifest.json"
···8997 if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
9098 strategy:
9199 fail-fast: false
9292- # Target platforms/runners are computed by cargo-dist in create-release.
100100+ # Target platforms/runners are computed by dist in create-release.
93101 # Each member of the matrix has the following arguments:
94102 #
95103 # - runner: the github runner
9696- # - dist-args: cli flags to pass to cargo dist
9797- # - install-dist: expression to run to install cargo-dist on the runner
104104+ # - dist-args: cli flags to pass to dist
105105+ # - install-dist: expression to run to install dist on the runner
98106 #
99107 # Typically there will be:
100108 # - 1 "global" task that builds universal installers
101109 # - N "local" tasks that build each platform's binaries and platform-specific installers
102110 matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
103111 runs-on: ${{ matrix.runner }}
112112+ container: ${{ matrix.container && matrix.container.image || null }}
104113 env:
105114 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106115 BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
···110119 git config --global core.longpaths true
111120 - uses: actions/checkout@v4
112121 with:
122122+ persist-credentials: false
113123 submodules: recursive
114114- - uses: swatinem/rust-cache@v2
115115- with:
116116- key: ${{ join(matrix.targets, '-') }}
117117- - name: Install cargo-dist
118118- run: ${{ matrix.install_dist }}
124124+ - name: Install Rust non-interactively if not already installed
125125+ if: ${{ matrix.container }}
126126+ run: |
127127+ if ! command -v cargo > /dev/null 2>&1; then
128128+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
129129+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
130130+ fi
131131+ - name: Install dist
132132+ run: ${{ matrix.install_dist.run }}
119133 # Get the dist-manifest
120134 - name: Fetch local artifacts
121135 uses: actions/download-artifact@v4
···129143 - name: Build artifacts
130144 run: |
131145 # Actually do builds and make zips and whatnot
132132- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
133133- echo "cargo dist ran successfully"
146146+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
147147+ echo "dist ran successfully"
134148 - id: cargo-dist
135149 name: Post-build
136150 # We force bash here just because github makes it really hard to get values up
···140154 run: |
141155 # Parse out what we just built and upload it to scratch storage
142156 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
143143- jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
157157+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
144158 echo "EOF" >> "$GITHUB_OUTPUT"
145159146160 cp dist-manifest.json "$BUILD_MANIFEST_NAME"
···157171 needs:
158172 - plan
159173 - build-local-artifacts
160160- runs-on: "ubuntu-20.04"
174174+ runs-on: "ubuntu-22.04"
161175 env:
162176 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163177 BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
164178 steps:
165179 - uses: actions/checkout@v4
166180 with:
181181+ persist-credentials: false
167182 submodules: recursive
168168- - name: Install cargo-dist
169169- shell: bash
170170- run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.3/cargo-dist-installer.sh | sh"
183183+ - name: Install cached dist
184184+ uses: actions/download-artifact@v4
185185+ with:
186186+ name: cargo-dist-cache
187187+ path: ~/.cargo/bin/
188188+ - run: chmod +x ~/.cargo/bin/dist
171189 # Get all the local artifacts for the global tasks to use (for e.g. checksums)
172190 - name: Fetch local artifacts
173191 uses: actions/download-artifact@v4
···178196 - id: cargo-dist
179197 shell: bash
180198 run: |
181181- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
182182- echo "cargo dist ran successfully"
199199+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
200200+ echo "dist ran successfully"
183201184202 # Parse out what we just built and upload it to scratch storage
185203 echo "paths<<EOF" >> "$GITHUB_OUTPUT"
···204222 if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
205223 env:
206224 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207207- runs-on: "ubuntu-20.04"
225225+ runs-on: "ubuntu-22.04"
208226 outputs:
209227 val: ${{ steps.host.outputs.manifest }}
210228 steps:
211229 - uses: actions/checkout@v4
212230 with:
231231+ persist-credentials: false
213232 submodules: recursive
214214- - name: Install cargo-dist
215215- run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.13.3/cargo-dist-installer.sh | sh"
233233+ - name: Install cached dist
234234+ uses: actions/download-artifact@v4
235235+ with:
236236+ name: cargo-dist-cache
237237+ path: ~/.cargo/bin/
238238+ - run: chmod +x ~/.cargo/bin/dist
216239 # Fetch artifacts from scratch-storage
217240 - name: Fetch artifacts
218241 uses: actions/download-artifact@v4
···220243 pattern: artifacts-*
221244 path: target/distrib/
222245 merge-multiple: true
223223- # This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
224246 - id: host
225247 shell: bash
226248 run: |
227227- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
249249+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
228250 echo "artifacts uploaded and released successfully"
229251 cat dist-manifest.json
230252 echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
···234256 # Overwrite the previous copy
235257 name: artifacts-dist-manifest
236258 path: dist-manifest.json
259259+ # Create a GitHub Release while uploading all files to it
260260+ - name: "Download GitHub Artifacts"
261261+ uses: actions/download-artifact@v4
262262+ with:
263263+ pattern: artifacts-*
264264+ path: artifacts
265265+ merge-multiple: true
266266+ - name: Cleanup
267267+ run: |
268268+ # Remove the granular manifests
269269+ rm -f artifacts/*-dist-manifest.json
270270+ - name: Create GitHub Release
271271+ env:
272272+ PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
273273+ ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
274274+ ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}"
275275+ RELEASE_COMMIT: "${{ github.sha }}"
276276+ run: |
277277+ # Write and read notes from a file to avoid quoting breaking things
278278+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
237279238238- # Create a GitHub Release while uploading all files to it
280280+ gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
281281+239282 announce:
240283 needs:
241284 - plan
···244287 # still allowing individual publish jobs to skip themselves (for prereleases).
245288 # "host" however must run to completion, no skipping allowed!
246289 if: ${{ always() && needs.host.result == 'success' }}
247247- runs-on: "ubuntu-20.04"
290290+ runs-on: "ubuntu-22.04"
248291 env:
249292 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250293 steps:
251294 - uses: actions/checkout@v4
252295 with:
296296+ persist-credentials: false
253297 submodules: recursive
254254- - name: "Download GitHub Artifacts"
255255- uses: actions/download-artifact@v4
256256- with:
257257- pattern: artifacts-*
258258- path: artifacts
259259- merge-multiple: true
260260- - name: Cleanup
261261- run: |
262262- # Remove the granular manifests
263263- rm -f artifacts/*-dist-manifest.json
264264- - name: Create GitHub Release
265265- uses: ncipollo/release-action@v1
266266- with:
267267- tag: ${{ needs.plan.outputs.tag }}
268268- name: ${{ fromJson(needs.host.outputs.val).announcement_title }}
269269- body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
270270- prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
271271- artifacts: "artifacts/*"
+1-16
Cargo.toml
···88keywords = ["CVM", "count-distinct", "estimation"]
99categories = ["algorithms", ]
10101111-version = "0.3.0"
1111+version = "0.3.1"
1212edition = "2021"
13131414[dependencies]
···4949[[bench]]
5050name = "benchmarks"
5151harness = false
5252-5353-# Config for 'cargo dist'
5454-[workspace.metadata.dist]
5555-# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
5656-cargo-dist-version = "0.13.3"
5757-# CI backends to support
5858-ci = ["github"]
5959-# The installers to generate for each app
6060-installers = ["shell"]
6161-# Target platforms to build apps for (Rust target-triple syntax)
6262-targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
6363-# Publish jobs to run in CI
6464-pr-run-mode = "plan"
6565-# Whether to install an updater program
6666-install-updater = false
+19
dist-workspace.toml
···11+[workspace]
22+members = ["cargo:."]
33+44+# Config for 'dist'
55+[dist]
66+# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
77+cargo-dist-version = "0.28.4"
88+# CI backends to support
99+ci = "github"
1010+# The installers to generate for each app
1111+installers = ["shell"]
1212+# Target platforms to build apps for (Rust target-triple syntax)
1313+targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
1414+# Which actions to run on pull requests
1515+pr-run-mode = "plan"
1616+# Whether to install an updater program
1717+install-updater = false
1818+# Path that installers should place binaries in
1919+install-path = "CARGO_HOME"