libsonic 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- libsonic-0.1.0/.coderabbit.yaml +17 -0
- libsonic-0.1.0/.github/CODEOWNERS +1 -0
- libsonic-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +25 -0
- libsonic-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- libsonic-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +16 -0
- libsonic-0.1.0/.github/renovate.json +12 -0
- libsonic-0.1.0/.github/scripts/publish-crate-if-needed.sh +32 -0
- libsonic-0.1.0/.github/scripts/semver-check.sh +36 -0
- libsonic-0.1.0/.github/scripts/wait-for-crate.sh +33 -0
- libsonic-0.1.0/.github/workflows/CI.yaml +68 -0
- libsonic-0.1.0/.github/workflows/audit.yaml +26 -0
- libsonic-0.1.0/.github/workflows/prepare-release.yaml +123 -0
- libsonic-0.1.0/.github/workflows/project-sync.yaml +16 -0
- libsonic-0.1.0/.github/workflows/publish-crates.yaml +67 -0
- libsonic-0.1.0/.github/workflows/publish-python.yaml +162 -0
- libsonic-0.1.0/.github/workflows/python.yaml +60 -0
- libsonic-0.1.0/.github/workflows/release.yaml +125 -0
- libsonic-0.1.0/.github/workflows/rust-lint.yaml +132 -0
- libsonic-0.1.0/.github/workflows/sonar.yaml +35 -0
- libsonic-0.1.0/.github/workflows/zizmor.yaml +34 -0
- libsonic-0.1.0/.gitignore +27 -0
- libsonic-0.1.0/.pre-commit-config.yaml +27 -0
- libsonic-0.1.0/Cargo.lock +616 -0
- libsonic-0.1.0/Cargo.toml +34 -0
- libsonic-0.1.0/LICENSE +201 -0
- libsonic-0.1.0/NOTICE +4 -0
- libsonic-0.1.0/PKG-INFO +33 -0
- libsonic-0.1.0/README.md +40 -0
- libsonic-0.1.0/benches/sonic.rs +37 -0
- libsonic-0.1.0/deny.toml +44 -0
- libsonic-0.1.0/pyproject.toml +20 -0
- libsonic-0.1.0/python/.gitignore +5 -0
- libsonic-0.1.0/python/Cargo.toml +24 -0
- libsonic-0.1.0/python/README.md +21 -0
- libsonic-0.1.0/python/src/lib.rs +66 -0
- libsonic-0.1.0/python/tests/test_libsonic.py +38 -0
- libsonic-0.1.0/rust-toolchain.toml +3 -0
- libsonic-0.1.0/scripts/bump-version.sh +36 -0
- libsonic-0.1.0/scripts/next-version.sh +54 -0
- libsonic-0.1.0/scripts/release-notes.sh +47 -0
- libsonic-0.1.0/sonar-project.properties +7 -0
- libsonic-0.1.0/src/lib.rs +665 -0
- libsonic-0.1.0/tests/common/mod.rs +142 -0
- libsonic-0.1.0/tests/sonic_golden.tsv +850 -0
- libsonic-0.1.0/tests/sonic_parity.rs +119 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
reviews:
|
|
2
|
+
path_filters:
|
|
3
|
+
- "!target/**"
|
|
4
|
+
- "!tests/sonic_golden.tsv"
|
|
5
|
+
|
|
6
|
+
instructions: |
|
|
7
|
+
- This is libsonic, a safe Rust port of Bill Cox's Sonic (PICOLA-style speech speed, pitch and volume changer).
|
|
8
|
+
- Focus strictly on correctness, panic-safety and numeric faithfulness to sonic.c. Avoid nitpicking style.
|
|
9
|
+
- Flag any arithmetic that could overflow or divide by zero on reachable input; integer widths and f32/f64 intermediates are deliberate and must match the C reference.
|
|
10
|
+
- Flag any `unwrap()`/`expect()`/panic on reachable paths outside tests. The crate forbids `unsafe`; flag any attempt to add it.
|
|
11
|
+
- tests/sonic_golden.tsv is a frozen output contract generated from C; flag any change to it that is not accompanied by an explanation of the intended behavior change.
|
|
12
|
+
|
|
13
|
+
path_instructions:
|
|
14
|
+
- path: "{.github/workflows/**,deny.toml}"
|
|
15
|
+
instructions: |
|
|
16
|
+
- Flag workflow changes that weaken pinned actions, widen permissions, or drop a platform from the test matrix.
|
|
17
|
+
- deny.toml enforces license policy; flag any widening without an explanatory comment.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @ZirekHQ/maintainers
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Output differs from Sonic, or the library panics or misbehaves.
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: version
|
|
7
|
+
attributes:
|
|
8
|
+
label: libsonic version
|
|
9
|
+
placeholder: e.g. 0.1.0 / commit abc1234
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: parameters
|
|
14
|
+
attributes:
|
|
15
|
+
label: Parameters
|
|
16
|
+
description: Sample rate, channels, speed, pitch, volume and how the audio was written (chunk sizes, flush).
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: expected
|
|
21
|
+
attributes:
|
|
22
|
+
label: Expected vs actual
|
|
23
|
+
description: If this is a parity bug, include the output of the C Sonic for the same input.
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest a capability or API change.
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: What problem does this solve?
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: proposal
|
|
13
|
+
attributes:
|
|
14
|
+
label: Proposed behavior
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": ["github>austek/renovate-config"],
|
|
4
|
+
"packageRules": [
|
|
5
|
+
{
|
|
6
|
+
"description": "Runtime deps (ort, clap, pyo3, ...) ship in the published crates/wheel/binaries, unlike build tooling or dev/test deps -- re-enable 'fix' so their bumps read as behavior-relevant in history, overriding the shared preset's blanket 'chore'.",
|
|
7
|
+
"matchManagers": ["cargo"],
|
|
8
|
+
"matchDepTypes": ["dependencies"],
|
|
9
|
+
"semanticCommitType": "fix"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lets release.yaml's publish job retry a partial failure (one crate published, the next 403s) by
|
|
3
|
+
# re-running from scratch without cargo publish hard-failing on an already-published version.
|
|
4
|
+
|
|
5
|
+
# crates.io 403s any request without a descriptive User-Agent (bare "curl/x.y.z" doesn't
|
|
6
|
+
# qualify) -- every lookup here would fail before checking anything without one.
|
|
7
|
+
|
|
8
|
+
# curl -sf can't tell 404 (not published) from a transient 5xx -- both are just nonzero
|
|
9
|
+
# exit, so capture the real code and branch on a value actually seen.
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
crate="${1:?usage: publish-crate-if-needed.sh <crate-name> <version>}"
|
|
13
|
+
version="${2:?usage: publish-crate-if-needed.sh <crate-name> <version>}"
|
|
14
|
+
|
|
15
|
+
status="$(curl -s -o /dev/null -w '%{http_code}' \
|
|
16
|
+
-H "User-Agent: libsonic-publish-ci (https://github.com/ZirekHQ/libsonic-rs)" \
|
|
17
|
+
"https://crates.io/api/v1/crates/${crate}/${version}")"
|
|
18
|
+
|
|
19
|
+
case "$status" in
|
|
20
|
+
200) echo "${crate} ${version} is already published -- skipping" ;;
|
|
21
|
+
404)
|
|
22
|
+
if [ "${DRY_RUN:-}" = "true" ]; then
|
|
23
|
+
cargo publish -p "$crate" --locked --dry-run
|
|
24
|
+
else
|
|
25
|
+
cargo publish -p "$crate" --locked
|
|
26
|
+
fi
|
|
27
|
+
;;
|
|
28
|
+
*)
|
|
29
|
+
echo "::error::Unexpected status ${status} checking crates.io for ${crate} ${version}" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Runs cargo-semver-checks against the release type scripts/next-version.sh
|
|
5
|
+
# would cut for the commits since the last tag. A breaking change that the
|
|
6
|
+
# commit history only classifies as minor/patch fails here, before release.
|
|
7
|
+
package="${1:?usage: semver-check.sh <package>}"
|
|
8
|
+
|
|
9
|
+
set +e
|
|
10
|
+
next="$(bash scripts/next-version.sh)"
|
|
11
|
+
rc=$?
|
|
12
|
+
set -e
|
|
13
|
+
if [ "$rc" -eq 1 ]; then
|
|
14
|
+
echo "::notice::No release-worthy commits since the last tag -- skipping semver check"
|
|
15
|
+
exit 0
|
|
16
|
+
elif [ "$rc" -eq 2 ]; then
|
|
17
|
+
echo "::notice::No release tag yet -- skipping semver check"
|
|
18
|
+
exit 0
|
|
19
|
+
elif [ "$rc" -ne 0 ]; then
|
|
20
|
+
exit "$rc"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
status="$(curl -s -o /dev/null -w '%{http_code}' -A 'ZirekHQ-ci' "https://crates.io/api/v1/crates/${package}")"
|
|
24
|
+
if [ "$status" = "404" ]; then
|
|
25
|
+
echo "::notice::${package} is not on crates.io yet -- skipping semver check until the first release"
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
case "$next" in
|
|
30
|
+
*.0.0) release_type="major" ;;
|
|
31
|
+
*.0) release_type="minor" ;;
|
|
32
|
+
*) release_type="patch" ;;
|
|
33
|
+
esac
|
|
34
|
+
|
|
35
|
+
echo "Checking ${package} for a ${release_type} release (${next})"
|
|
36
|
+
cargo semver-checks check-release -p "$package" --release-type "$release_type"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
name="$1"
|
|
5
|
+
version="$2"
|
|
6
|
+
|
|
7
|
+
# Poll the sparse index cargo actually resolves dependencies against, not the
|
|
8
|
+
# web API: a successful publish response doesn't guarantee the index has been
|
|
9
|
+
# updated yet (https://doc.rust-lang.org/cargo/reference/registry-web-api.html).
|
|
10
|
+
case "${#name}" in
|
|
11
|
+
1) prefix="1" ;;
|
|
12
|
+
2) prefix="2" ;;
|
|
13
|
+
3) prefix="3/${name:0:1}" ;;
|
|
14
|
+
*) prefix="${name:0:2}/${name:2:2}" ;;
|
|
15
|
+
esac
|
|
16
|
+
url="https://index.crates.io/${prefix}/${name}"
|
|
17
|
+
max_attempts=60
|
|
18
|
+
sleep_seconds=5
|
|
19
|
+
|
|
20
|
+
for attempt in $(seq 1 "$max_attempts"); do
|
|
21
|
+
body=$(curl -s --connect-timeout 10 --max-time 30 \
|
|
22
|
+
-H "User-Agent: libsonic-publish-ci (https://github.com/ZirekHQ/libsonic-rs)" \
|
|
23
|
+
"$url") || body=""
|
|
24
|
+
if printf '%s\n' "$body" | grep -q "\"vers\":\"${version}\""; then
|
|
25
|
+
echo "${name} ${version} is live on the crates.io index"
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
echo "Waiting for ${name} ${version} to appear on the crates.io index (attempt ${attempt}/${max_attempts})..."
|
|
29
|
+
sleep "$sleep_seconds"
|
|
30
|
+
done
|
|
31
|
+
|
|
32
|
+
echo "Timed out waiting for ${name} ${version} to appear on the crates.io index" >&2
|
|
33
|
+
exit 1
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ci-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
|
|
15
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
test:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 20
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
26
|
+
- name: cargo test
|
|
27
|
+
run: cargo test --locked --no-fail-fast
|
|
28
|
+
|
|
29
|
+
test-platform:
|
|
30
|
+
name: test-platform (${{ matrix.runner }})
|
|
31
|
+
runs-on: ${{ matrix.runner }}
|
|
32
|
+
timeout-minutes: 30
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
runner:
|
|
37
|
+
- windows-latest
|
|
38
|
+
- macos-latest
|
|
39
|
+
- ubuntu-24.04-arm
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
42
|
+
with:
|
|
43
|
+
persist-credentials: false
|
|
44
|
+
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
45
|
+
- name: cargo test
|
|
46
|
+
run: cargo test --locked --no-fail-fast
|
|
47
|
+
|
|
48
|
+
lint:
|
|
49
|
+
uses: ./.github/workflows/rust-lint.yaml # zizmor: ignore[self-repository] CI is pinned to zizmor v1.28.0, which predates $/ syntax support
|
|
50
|
+
permissions:
|
|
51
|
+
contents: read
|
|
52
|
+
issues: write
|
|
53
|
+
checks: write
|
|
54
|
+
code-quality: write
|
|
55
|
+
|
|
56
|
+
# The single required status check: one stable name that survives job and matrix renames.
|
|
57
|
+
build:
|
|
58
|
+
name: build
|
|
59
|
+
needs: [test, test-platform, lint]
|
|
60
|
+
if: always()
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
timeout-minutes: 5
|
|
63
|
+
permissions: {}
|
|
64
|
+
steps:
|
|
65
|
+
- name: Require every job to succeed
|
|
66
|
+
env:
|
|
67
|
+
NEEDS: ${{ toJSON(needs) }}
|
|
68
|
+
run: jq -e 'to_entries | all(.value.result == "success")' <<< "$NEEDS"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Security audit
|
|
2
|
+
|
|
3
|
+
# Advisories land against existing dependencies without any PR or push, so
|
|
4
|
+
# rust-lint.yaml's audit job alone only sees them on the next code change.
|
|
5
|
+
on:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "17 4 * * *"
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions: {}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
audit:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 15
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
issues: write
|
|
19
|
+
checks: write
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
- uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
|
|
25
|
+
with:
|
|
26
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
name: Prepare release
|
|
2
|
+
|
|
3
|
+
# Proposes a release; merging the opened PR is what actually cuts one -- release.yaml tags that
|
|
4
|
+
# merge commit and triggers every downstream release workflow automatically.
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
dry_run:
|
|
9
|
+
description: "Only compute the release plan, do not open the version-bump PR"
|
|
10
|
+
type: boolean
|
|
11
|
+
required: false
|
|
12
|
+
default: true
|
|
13
|
+
|
|
14
|
+
permissions: {}
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: prepare-release
|
|
18
|
+
cancel-in-progress: false
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
authorize:
|
|
22
|
+
name: Authorize
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
steps:
|
|
28
|
+
- name: Require a maintainer on main
|
|
29
|
+
env:
|
|
30
|
+
GH_TOKEN: ${{ github.token }}
|
|
31
|
+
ACTOR: ${{ github.triggering_actor }}
|
|
32
|
+
REPO: ${{ github.repository }}
|
|
33
|
+
REF: ${{ github.ref }}
|
|
34
|
+
run: |
|
|
35
|
+
set -euo pipefail
|
|
36
|
+
if [ "$REF" != 'refs/heads/main' ]; then
|
|
37
|
+
echo "::error::Releases are prepared from main, not $REF"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
role=$(gh api "repos/$REPO/collaborators/$ACTOR/permission" --jq .role_name)
|
|
41
|
+
case "$role" in
|
|
42
|
+
admin|maintain) echo "$ACTOR has role $role" ;;
|
|
43
|
+
*) echo "::error::$ACTOR has role '$role'; preparing a release needs admin or maintain"; exit 1 ;;
|
|
44
|
+
esac
|
|
45
|
+
|
|
46
|
+
prepare:
|
|
47
|
+
needs: authorize
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
timeout-minutes: 15
|
|
50
|
+
permissions:
|
|
51
|
+
contents: write
|
|
52
|
+
pull-requests: write
|
|
53
|
+
env:
|
|
54
|
+
APP_CLIENT_ID: ${{ secrets.AUTOMATION_APP_CLIENT_ID }}
|
|
55
|
+
APP_PRIVATE_KEY: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
|
|
56
|
+
steps:
|
|
57
|
+
- name: Create release app token
|
|
58
|
+
id: app-token
|
|
59
|
+
# A PR opened with GITHUB_TOKEN gets no CI, so it could never satisfy the required
|
|
60
|
+
# `build` check. Without the app secrets the PR is still opened, but needs a manual
|
|
61
|
+
# close/reopen to start its checks.
|
|
62
|
+
if: ${{ !inputs.dry_run && env.APP_CLIENT_ID != '' && env.APP_PRIVATE_KEY != '' }}
|
|
63
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
64
|
+
with:
|
|
65
|
+
client-id: ${{ secrets.AUTOMATION_APP_CLIENT_ID }}
|
|
66
|
+
private-key: ${{ env.APP_PRIVATE_KEY }}
|
|
67
|
+
permission-contents: write
|
|
68
|
+
permission-pull-requests: write
|
|
69
|
+
|
|
70
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
71
|
+
with:
|
|
72
|
+
ref: main
|
|
73
|
+
token: ${{ steps.app-token.outputs.token || github.token }}
|
|
74
|
+
persist-credentials: true
|
|
75
|
+
fetch-depth: 0
|
|
76
|
+
- uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master
|
|
77
|
+
with:
|
|
78
|
+
toolchain: "1.99.0"
|
|
79
|
+
|
|
80
|
+
- name: Compute next version
|
|
81
|
+
id: next
|
|
82
|
+
run: |
|
|
83
|
+
set -uo pipefail
|
|
84
|
+
# exit 1 = normal "nothing release-worthy", treated as skip. Any
|
|
85
|
+
# other exit means the computation itself is broken and must fail
|
|
86
|
+
# loudly, or a broken tag state would silently suppress every future release.
|
|
87
|
+
# The `&& rc=0 || rc=$?` form keeps the default `bash -e` shell from aborting on exit 1.
|
|
88
|
+
version="$(bash scripts/next-version.sh)" && rc=0 || rc=$?
|
|
89
|
+
if [ "$rc" -eq 0 ]; then
|
|
90
|
+
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
|
91
|
+
echo "### Release plan: v${version}" >> "$GITHUB_STEP_SUMMARY"
|
|
92
|
+
elif [ "$rc" -eq 1 ]; then
|
|
93
|
+
echo "::notice::Nothing release-worthy since the last tag -- skipping"
|
|
94
|
+
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
95
|
+
echo "### Release plan: nothing to release" >> "$GITHUB_STEP_SUMMARY"
|
|
96
|
+
else
|
|
97
|
+
echo "::error::scripts/next-version.sh failed (exit ${rc})"
|
|
98
|
+
exit "$rc"
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
- name: Bump version
|
|
102
|
+
if: steps.next.outputs.skip != 'true' && !inputs.dry_run
|
|
103
|
+
env:
|
|
104
|
+
VERSION: ${{ steps.next.outputs.version }}
|
|
105
|
+
run: bash scripts/bump-version.sh "$VERSION"
|
|
106
|
+
|
|
107
|
+
- name: Open release PR
|
|
108
|
+
if: steps.next.outputs.skip != 'true' && !inputs.dry_run
|
|
109
|
+
env:
|
|
110
|
+
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
|
111
|
+
VERSION: ${{ steps.next.outputs.version }}
|
|
112
|
+
run: |
|
|
113
|
+
set -euo pipefail
|
|
114
|
+
branch="chore/bump-${VERSION}"
|
|
115
|
+
git config user.name "github-actions[bot]"
|
|
116
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
117
|
+
git checkout -b "$branch"
|
|
118
|
+
git add Cargo.toml Cargo.lock README.md
|
|
119
|
+
git commit -m "chore: bump version -> ${VERSION}"
|
|
120
|
+
git push -u origin "$branch"
|
|
121
|
+
gh pr create --title "chore: bump version -> ${VERSION}" \
|
|
122
|
+
--body "Computed by \`prepare-release.yaml\` from Conventional Commit subjects since the last tag (see \`scripts/next-version.sh\`). **Merging this releases v${VERSION}**: \`release.yaml\` tags this merge commit and publishes to crates.io and GitHub Releases. The required checks on this PR are the only gate." \
|
|
123
|
+
--base main --head "$branch"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Project sync
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types: [opened, assigned]
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened]
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
sync:
|
|
13
|
+
uses: ZirekHQ/.github/.github/workflows/project-sync.yml@402ea18a978f5dbe0f34683b7dd49ab579862d41 # main
|
|
14
|
+
secrets:
|
|
15
|
+
PROJECT_APP_CLIENT_ID: ${{ secrets.PROJECT_APP_CLIENT_ID }}
|
|
16
|
+
PROJECT_APP_PRIVATE_KEY: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Publish to crates.io
|
|
2
|
+
|
|
3
|
+
# Invoked as a job of release.yaml's flow. Covered by prepare-release.yaml's gate job on the
|
|
4
|
+
# direct-release override path, or by the PR merge on the normal push path -- has none of its
|
|
5
|
+
# own. Not tag-triggered itself, so a stray tag push can't fire a real publish.
|
|
6
|
+
on:
|
|
7
|
+
workflow_call:
|
|
8
|
+
inputs:
|
|
9
|
+
dry_run:
|
|
10
|
+
required: false
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
publish:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 30
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
id-token: write
|
|
24
|
+
env:
|
|
25
|
+
DRY_RUN: ${{ inputs.dry_run == true }}
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
|
+
with:
|
|
29
|
+
persist-credentials: false
|
|
30
|
+
- uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master
|
|
31
|
+
with:
|
|
32
|
+
toolchain: "1.99.0"
|
|
33
|
+
# github.workflow_ref binds to the run's top-level caller through nested workflow_call
|
|
34
|
+
# hops too (see piper-rs #107) -- release.yaml on the push path, prepare-release.yaml on
|
|
35
|
+
# the override path. crates.io's Trusted Publishing must register BOTH, or the override path 400s.
|
|
36
|
+
- name: verify OIDC workflow_ref matches crates.io Trusted Publishing target
|
|
37
|
+
env:
|
|
38
|
+
WORKFLOW_REF: ${{ github.workflow_ref }}
|
|
39
|
+
run: |
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
expected_release="ZirekHQ/libsonic-rs/.github/workflows/release.yaml"
|
|
42
|
+
expected_prepare="ZirekHQ/libsonic-rs/.github/workflows/prepare-release.yaml"
|
|
43
|
+
actual="${WORKFLOW_REF%@*}"
|
|
44
|
+
if [ "$actual" != "$expected_release" ] && [ "$actual" != "$expected_prepare" ]; then
|
|
45
|
+
echo "::error::OIDC workflow_ref is '${actual}', expected '${expected_release}' or '${expected_prepare}'. crates.io Trusted Publishing must target both -- if either workflow was renamed, update crates.io's config and this check together." >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
- name: Authenticate with crates.io
|
|
49
|
+
id: auth
|
|
50
|
+
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
|
|
51
|
+
|
|
52
|
+
- name: Resolve workspace version
|
|
53
|
+
# Read from [package] rather than hardcoding the version here,
|
|
54
|
+
# so this file doesn't silently go stale (and publish the wrong version)
|
|
55
|
+
# the next time the workspace version bumps.
|
|
56
|
+
id: version
|
|
57
|
+
run: |
|
|
58
|
+
set -euo pipefail
|
|
59
|
+
version="$(awk '/^\[package\]/{f=1;next} /^\[/{f=0} f && /^version = /{gsub(/version = "|"/,""); print; exit}' Cargo.toml)"
|
|
60
|
+
[ -n "$version" ] || { echo "::error::No [package].version in Cargo.toml" >&2; exit 1; }
|
|
61
|
+
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
|
62
|
+
|
|
63
|
+
- name: publish libsonic
|
|
64
|
+
env:
|
|
65
|
+
VERSION: ${{ steps.version.outputs.version }}
|
|
66
|
+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|
|
67
|
+
run: bash .github/scripts/publish-crate-if-needed.sh libsonic "$VERSION"
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
name: Publish Python wheels
|
|
2
|
+
|
|
3
|
+
# Invoked as a job of release.yaml right after the release tag is pushed. PyO3 builds abi3
|
|
4
|
+
# wheels, so one wheel per platform covers every supported CPython.
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
tag:
|
|
9
|
+
description: Existing release tag to build and publish, e.g. v0.1.0
|
|
10
|
+
required: true
|
|
11
|
+
type: string
|
|
12
|
+
dry_run:
|
|
13
|
+
required: false
|
|
14
|
+
type: boolean
|
|
15
|
+
default: false
|
|
16
|
+
workflow_call:
|
|
17
|
+
inputs:
|
|
18
|
+
tag:
|
|
19
|
+
required: true
|
|
20
|
+
type: string
|
|
21
|
+
dry_run:
|
|
22
|
+
required: false
|
|
23
|
+
type: boolean
|
|
24
|
+
default: false
|
|
25
|
+
|
|
26
|
+
permissions: {}
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
check-version:
|
|
30
|
+
name: Verify tag matches crate version
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
timeout-minutes: 10
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
ref: ${{ inputs.tag || github.ref_name }}
|
|
39
|
+
persist-credentials: false
|
|
40
|
+
|
|
41
|
+
- name: Compare tag to crate version
|
|
42
|
+
env:
|
|
43
|
+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
|
|
44
|
+
run: |
|
|
45
|
+
set -euo pipefail
|
|
46
|
+
tag_version="$(echo "${RELEASE_TAG}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+.*$')"
|
|
47
|
+
cargo_version="$(awk '/^\[package\]/{f=1;next} /^\[/{f=0} f && /^version = /{gsub(/version = "|"/,""); print; exit}' python/Cargo.toml)"
|
|
48
|
+
if [ "${tag_version}" != "${cargo_version}" ]; then
|
|
49
|
+
echo "::error::Tag ${RELEASE_TAG} (version ${tag_version}) does not match python/Cargo.toml version ${cargo_version}"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
build-wheels:
|
|
54
|
+
name: build (${{ matrix.target }})
|
|
55
|
+
needs: check-version
|
|
56
|
+
runs-on: ${{ matrix.runner }}
|
|
57
|
+
timeout-minutes: 30
|
|
58
|
+
permissions:
|
|
59
|
+
contents: read
|
|
60
|
+
strategy:
|
|
61
|
+
fail-fast: false
|
|
62
|
+
matrix:
|
|
63
|
+
include:
|
|
64
|
+
- target: x86_64-unknown-linux-gnu
|
|
65
|
+
runner: ubuntu-latest
|
|
66
|
+
manylinux: auto
|
|
67
|
+
- target: aarch64-unknown-linux-gnu
|
|
68
|
+
runner: ubuntu-24.04-arm
|
|
69
|
+
manylinux: auto
|
|
70
|
+
- target: aarch64-apple-darwin
|
|
71
|
+
runner: macos-14
|
|
72
|
+
manylinux: auto
|
|
73
|
+
- target: x86_64-pc-windows-msvc
|
|
74
|
+
runner: windows-latest
|
|
75
|
+
manylinux: auto
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
78
|
+
with:
|
|
79
|
+
ref: ${{ inputs.tag || github.ref_name }}
|
|
80
|
+
persist-credentials: false
|
|
81
|
+
|
|
82
|
+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
83
|
+
with:
|
|
84
|
+
python-version: "3.14"
|
|
85
|
+
|
|
86
|
+
- name: Build wheel
|
|
87
|
+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
|
|
88
|
+
with:
|
|
89
|
+
working-directory: python
|
|
90
|
+
target: ${{ matrix.target }}
|
|
91
|
+
manylinux: ${{ matrix.manylinux }}
|
|
92
|
+
args: --release --out dist
|
|
93
|
+
|
|
94
|
+
- name: Smoke-test the built wheel
|
|
95
|
+
shell: bash
|
|
96
|
+
run: |
|
|
97
|
+
set -euo pipefail
|
|
98
|
+
python -m pip install --only-binary :all: pytest==9.1.1
|
|
99
|
+
req="$RUNNER_TEMP/wheel-requirement.txt"
|
|
100
|
+
python - "$req" <<'PY'
|
|
101
|
+
import hashlib, pathlib, sys
|
|
102
|
+
(whl,) = pathlib.Path("python/dist").glob("*.whl")
|
|
103
|
+
digest = hashlib.sha256(whl.read_bytes()).hexdigest()
|
|
104
|
+
pathlib.Path(sys.argv[1]).write_text(f"{whl.resolve().as_uri()} --hash=sha256:{digest}\n")
|
|
105
|
+
PY
|
|
106
|
+
python -m pip install --require-hashes --no-index --no-deps --only-binary :all: -r "$req"
|
|
107
|
+
python -m pytest python/tests
|
|
108
|
+
|
|
109
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
110
|
+
with:
|
|
111
|
+
name: wheels-${{ matrix.target }}
|
|
112
|
+
path: python/dist/*.whl
|
|
113
|
+
if-no-files-found: error
|
|
114
|
+
|
|
115
|
+
build-sdist:
|
|
116
|
+
name: build (sdist)
|
|
117
|
+
needs: check-version
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
timeout-minutes: 15
|
|
120
|
+
permissions:
|
|
121
|
+
contents: read
|
|
122
|
+
steps:
|
|
123
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
124
|
+
with:
|
|
125
|
+
ref: ${{ inputs.tag || github.ref_name }}
|
|
126
|
+
persist-credentials: false
|
|
127
|
+
|
|
128
|
+
- name: Build sdist
|
|
129
|
+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
|
|
130
|
+
with:
|
|
131
|
+
working-directory: python
|
|
132
|
+
command: sdist
|
|
133
|
+
args: --out dist
|
|
134
|
+
|
|
135
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
136
|
+
with:
|
|
137
|
+
name: wheels-sdist
|
|
138
|
+
path: python/dist/*.tar.gz
|
|
139
|
+
if-no-files-found: error
|
|
140
|
+
|
|
141
|
+
publish:
|
|
142
|
+
name: Publish to PyPI
|
|
143
|
+
needs: [build-wheels, build-sdist]
|
|
144
|
+
runs-on: ubuntu-latest
|
|
145
|
+
timeout-minutes: 15
|
|
146
|
+
environment: pypi
|
|
147
|
+
permissions:
|
|
148
|
+
id-token: write
|
|
149
|
+
steps:
|
|
150
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
151
|
+
with:
|
|
152
|
+
pattern: wheels-*
|
|
153
|
+
path: dist
|
|
154
|
+
merge-multiple: true
|
|
155
|
+
|
|
156
|
+
- name: Publish to PyPI
|
|
157
|
+
if: inputs.dry_run != true
|
|
158
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
159
|
+
with:
|
|
160
|
+
packages-dir: dist
|
|
161
|
+
skip-existing: true
|
|
162
|
+
attestations: false
|