diff --git a/.github/workflows/enforce-linking-issues.yml b/.github/workflows/enforce-linking-issues.yml deleted file mode 100644 index ebeddd9e..00000000 --- a/.github/workflows/enforce-linking-issues.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Enforce linking issues - -on: - pull_request_target: - types: [opened, edited, labeled] - -jobs: - main: - uses: eclipse-zenoh/zenoh/.github/workflows/enforce-linking-issues.yml@main - secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 490811ca..69098a19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,62 @@ name: Release on: - release: - types: [published] schedule: - cron: "0 1 * * 1-5" workflow_dispatch: + inputs: + live-run: + type: boolean + description: Live-run + required: false + version: + type: string + description: Release number + required: false + zenoh-version: + type: string + description: Release number of Zenoh + required: false jobs: - macos: + tag: + name: Branch, Bump & tag + runs-on: ubuntu-latest + outputs: + version: ${{ steps.create-release-branch.outputs.version }} + branch: ${{ steps.create-release-branch.outputs.branch }} + steps: + - id: create-release-branch + uses: eclipse-zenoh/ci/create-release-branch@main + with: + repo: ${{ github.repository }} + live-run: ${{ inputs.live-run || false }} + version: ${{ inputs.version }} + github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} + + - name: Checkout this repository + uses: actions/checkout@v4 + with: + ref: ${{ steps.create-release-branch.outputs.branch }} + + - name: Bump and tag project + run: bash ci/scripts/bump-and-tag.bash + env: + VERSION: ${{ steps.create-release-branch.outputs.version }} + BUMP_DEPS_VERSION: ${{ inputs.zenoh-version }} + BUMP_DEPS_PATTERN: ${{ inputs.zenoh-version && 'zenoh.*' || '' }} + BUMP_DEPS_BRANCH: ${{ inputs.zenoh-version && format('release/{0}', inputs.zenoh-version) || '' }} + GIT_USER_NAME: eclipse-zenoh-bot + GIT_USER_EMAIL: eclipse-zenoh-bot@users.noreply.github.com + + build-macos: + needs: tag runs-on: macos-latest steps: - name: Checkout this repository uses: actions/checkout@v4 + with: + ref: ${{ needs.tag.outputs.branch }} - name: Install Rust toolchain run: | @@ -36,7 +80,8 @@ jobs: name: wheels path: dist - windows: + build-windows: + needs: tag runs-on: windows-latest strategy: matrix: @@ -45,6 +90,8 @@ jobs: steps: - name: Checkout this repository uses: actions/checkout@v4 + with: + ref: ${{ needs.tag.outputs.branch }} - name: Install Rust toolchain run: | @@ -63,7 +110,8 @@ jobs: name: wheels path: dist - linux: + build-linux: + needs: tag runs-on: ubuntu-latest strategy: matrix: @@ -71,6 +119,8 @@ jobs: steps: - name: Checkout this repository uses: actions/checkout@v4 + with: + ref: ${{ needs.tag.outputs.branch }} - name: Build wheels uses: messense/maturin-action@v1 @@ -85,11 +135,14 @@ jobs: name: wheels path: dist - linux-aarch64: + build-linux-aarch64: + needs: tag runs-on: ubuntu-latest steps: - name: Checkout this repository uses: actions/checkout@v4 + with: + ref: ${{ needs.tag.outputs.branch }} - name: Build wheels uses: messense/maturin-action@v1 @@ -110,18 +163,21 @@ jobs: name: wheels path: dist - linux-armv6: + build-linux-armv6: + needs: tag runs-on: macos-latest steps: - name: Checkout this repository uses: actions/checkout@v4 + with: + ref: ${{ needs.tag.outputs.branch }} - name: Install Rust toolchain run: | rustup set profile minimal rustup target add arm-unknown-linux-gnueabihf - - name: install cross toolchain + - name: Install cross toolchain run: | brew tap messense/macos-cross-toolchains brew install arm-unknown-linux-gnueabihf @@ -140,19 +196,50 @@ jobs: name: wheels path: dist - deploy-wheels: - needs: [macos, windows, linux, linux-armv6] - name: deploy wheels to pypi + publish-pypi: + needs: + [ + tag, + build-macos, + build-windows, + build-linux, + build-linux-armv6, + build-linux-aarch64, + ] + name: Deploy wheels to pypi runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v3 with: name: wheels path: dist + - name: Check dist run: ls -al ./dist/* - - name: publish - if: github.event_name == 'release' && github.event.action == 'published' - uses: pypa/gh-action-pypi-publish@v1.6.4 + + - name: Publish + if: ${{ inputs.live-run || false }} + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_ORG_TOKEN }} + + publish-github: + needs: + [ + tag, + build-macos, + build-windows, + build-linux, + build-linux-armv6, + build-linux-aarch64, + ] + runs-on: ubuntu-latest + steps: + - uses: eclipse-zenoh/ci/publish-crates-github@main + with: + repo: ${{ github.repository }} + live-run: ${{ inputs.live-run || false }} + version: ${{ needs.tag.outputs.version }} + branch: ${{ needs.tag.outputs.branch }} + github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} + archive-patterns: "^$" diff --git a/.readthedocs.yml b/.readthedocs.yml index 30b8ac3d..5ed51ef2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -26,7 +26,7 @@ sphinx: build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.11" rust: "latest" jobs: pre_build: diff --git a/ci/scripts/bump-and-tag.bash b/ci/scripts/bump-and-tag.bash new file mode 100644 index 00000000..a883352c --- /dev/null +++ b/ci/scripts/bump-and-tag.bash @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +set -xeo pipefail + +# Release number +readonly version=${VERSION:?input VERSION is required} +# Dependencies' pattern +readonly bump_deps_pattern=${BUMP_DEPS_PATTERN:-''} +# Dependencies' version +readonly bump_deps_version=${BUMP_DEPS_VERSION:-''} +# Dependencies' git branch +readonly bump_deps_branch=${BUMP_DEPS_BRANCH:-''} +# Git actor name +readonly git_user_name=${GIT_USER_NAME:?input GIT_USER_NAME is required} +# Git actor email +readonly git_user_email=${GIT_USER_EMAIL:?input GIT_USER_EMAIL is required} + +cargo +stable install toml-cli + +# NOTE(fuzzypixelz): toml-cli doesn't yet support in-place modification +# See: https://github.com/gnprice/toml-cli?tab=readme-ov-file#writing-ish-toml-set +function toml_set_in_place() { + local tmp=$(mktemp) + toml set "$1" "$2" "$3" > "$tmp" + mv "$tmp" "$1" +} + +export GIT_AUTHOR_NAME=$git_user_name +export GIT_AUTHOR_EMAIL=$git_user_email +export GIT_COMMITTER_NAME=$git_user_name +export GIT_COMMITTER_EMAIL=$git_user_email + +# Bump Cargo version +toml_set_in_place Cargo.toml "package.version" "$version" +# Propagate version change to pyproject.toml +toml_set_in_place pyproject.toml "project.version" "$version" + +git commit Cargo.toml pyproject.toml -m "chore: Bump version to $version" + +# Select all package dependencies that match $bump_deps_pattern and bump them to $bump_deps_version +if [[ "$bump_deps_pattern" != '' ]]; then + deps=$(toml get Cargo.toml dependencies | jq -r "keys[] | select(test(\"$bump_deps_pattern\"))") + for dep in $deps; do + if [[ -n $bump_deps_version ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.version" "$bump_deps_version" + fi + + if [[ -n $bump_deps_branch ]]; then + toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$bump_deps_branch" + fi + done + # Update lockfile + cargo check + + if [[ -n $bump_deps_version || -n $bump_deps_branch ]]; then + git commit Cargo.toml Cargo.lock -m "chore: Bump $bump_deps_pattern version to $bump_deps_version" + else + echo "warn: no changes have been made to any dependencies matching $bump_deps_pattern" + fi +fi + +git tag --force "$version" -m "v$version" +git log -10 +git show-ref --tags +git push origin +git push --force origin "$version" diff --git a/docs/conf.py b/docs/conf.py index 466644c1..f31c384e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,6 +23,8 @@ # -- Project setup -------------------------------------------------------------- +import tomllib + import zenoh # -- Project information ----------------------------------------------------- @@ -31,8 +33,9 @@ copyright = '2020, ZettaScale Zenoh team, ' author = 'ZettaScale Zenoh team, ' -# The full version, including alpha/beta/rc tags -release = '0.11.0-dev' +# Extract the release number from the Cargo manifest +with open("../Cargo.toml", "rb") as f: + release = tomllib.load(f)["package"]["version"] # -- General configuration ---------------------------------------------------