Bump tokio from 1.47.1 to 1.48.0 (#50) #84
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: Rust Cross-Platform Build, Test, and Release | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: rust-build-test-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.platform.build_name }} | |
| runs-on: ${{ matrix.platform.runs_on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - build_name: Linux-x86_64 | |
| runs_on: ubuntu-latest | |
| rust_target: x86_64-unknown-linux-gnu | |
| packages: "" # default to all packages | |
| - build_name: Linux-x86_64-musl | |
| runs_on: ubuntu-latest | |
| rust_target: x86_64-unknown-linux-musl | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-aarch64 | |
| runs_on: ubuntu-24.04-arm | |
| rust_target: aarch64-unknown-linux-gnu | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-aarch64-musl | |
| runs_on: ubuntu-24.04-arm | |
| rust_target: aarch64-unknown-linux-musl | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-armv7 | |
| runs_on: ubuntu-latest | |
| rust_target: armv7-unknown-linux-gnueabihf | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-arm-musl | |
| runs_on: ubuntu-latest | |
| rust_target: arm-unknown-linux-musleabi | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-riscv64 | |
| runs_on: ubuntu-latest | |
| rust_target: riscv64gc-unknown-linux-gnu | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Linux-i686-gnu | |
| runs_on: ubuntu-latest | |
| rust_target: i686-unknown-linux-gnu | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: FreeBSD-x86_64 | |
| runs_on: ubuntu-latest | |
| rust_target: x86_64-unknown-freebsd | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Windows-x86_64 | |
| runs_on: windows-latest | |
| rust_target: x86_64-pc-windows-msvc | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: Windows-aarch64 | |
| runs_on: windows-11-arm | |
| rust_target: aarch64-pc-windows-msvc | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: macOS-x86_64 | |
| runs_on: macOS-latest | |
| rust_target: x86_64-apple-darwin | |
| packages: "-p nice_common -p nice_client" | |
| - build_name: macOS-aarch64 | |
| runs_on: macOS-latest | |
| rust_target: aarch64-apple-darwin | |
| packages: "-p nice_common -p nice_client" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Test, using cross when needed. This action can also install required toolchains. | |
| - name: Run tests | |
| # Skip tests for targets that can't run on the host system (e.g. freebsd) | |
| if: ${{ !contains(matrix.platform.rust_target, 'freebsd') }} | |
| # https://github.com/houseabsolute/actions-rust-cross | |
| uses: houseabsolute/actions-rust-cross@v1 | |
| with: | |
| command: test | |
| target: ${{ matrix.platform.rust_target }} | |
| args: "${{ matrix.platform.packages }} --locked --release --no-fail-fast" | |
| # Build, using cross when needed. This will explicitly put the binaries in a stable location. | |
| - name: Build binaries | |
| # https://github.com/houseabsolute/actions-rust-cross | |
| uses: houseabsolute/actions-rust-cross@v1 | |
| with: | |
| command: build | |
| target: ${{ matrix.platform.rust_target }} | |
| args: "${{ matrix.platform.packages }} --locked --release" | |
| # Package a single executable as a tarball/zip plus checksum for release upload. | |
| - name: Create release artifacts | |
| # https://github.com/houseabsolute/actions-rust-release | |
| uses: houseabsolute/actions-rust-release@v0 | |
| with: | |
| executable-name: nice_client | |
| target: ${{ matrix.platform.rust_target }} | |
| changes-file: CHANGELOG.md | |
| release-tag-prefix: "dont-make-releases" | |
| release: | |
| name: Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| # Generate release notes from CHANGELOG.md section matching the tag. | |
| # Expected format: headings like "## 3.2.3" (or "## [3.2.3]") somewhere in CHANGELOG.md. | |
| - name: Generate release notes from CHANGELOG.md | |
| id: notes | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| TAG="${GITHUB_REF_NAME}" # e.g. v3.2.3 | |
| VER="${TAG#v}" # e.g. 3.2.3 | |
| # Find start line for this version's section. | |
| start="$(grep -nE "^##[[:space:]]+Nice[[:space:]]+v${VER}([[:space:]]|$)" CHANGELOG.md | head -n1 | cut -d: -f1 || true)" | |
| if [ -z "${start}" ]; then | |
| echo "Could not find a CHANGELOG section header for version '${VER}'." | |
| echo "Expected a line like: '## Nice v${VER}'." | |
| exit 1 | |
| fi | |
| # Find next section header after start (exclusive) | |
| next="$(tail -n +$((start+1)) CHANGELOG.md | grep -nE "^##[[:space:]]" | head -n1 | cut -d: -f1 || true)" | |
| if [ -n "${next}" ]; then | |
| end=$((start + next - 2)) | |
| else | |
| end="$(wc -l < CHANGELOG.md)" | |
| fi | |
| # Extract notes (skip the header line itself) | |
| notes_file="release-notes.md" | |
| awk -v s="${start}" -v e="${end}" 'NR>s && NR<=e {print}' CHANGELOG.md > "${notes_file}" | |
| # If the section is empty (e.g. only whitespace), fail to avoid publishing blank notes. | |
| if ! grep -q '[^[:space:]]' "${notes_file}"; then | |
| echo "CHANGELOG section for ${VER} is empty." | |
| exit 1 | |
| fi | |
| echo "notes_file=${notes_file}" >> "${GITHUB_OUTPUT}" | |
| - name: Create GitHub release and upload assets | |
| # https://github.com/softprops/action-gh-release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| body_path: ${{ steps.notes.outputs.notes_file }} | |
| fail_on_unmatched_files: true | |
| files: | | |
| dist/**/nice_client-*.tar.gz | |
| dist/**/nice_client-*.tar.gz.sha256 | |
| dist/**/nice_client-*.zip | |
| dist/**/nice_client-*.zip.sha256 |