common_traits 0.13.0

Traits to write generic functions on different numeric types, with atomic support, and other features.
Documentation
name: Release

on:
  push:
    branches:
      - "main"
      - "master"
    tags:
      - "*"

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
      - name: Install stable toolchain
        run: rustup toolchain install stable --profile minimal --component rustfmt
      - name: Check that the tag is the same as the version in Cargo.toml
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          if ! grep -q "version = \"${{ github.ref_name }}\"" Cargo.toml; then
              echo "Cargo.toml does not contain the current tag as the version."
              exit 1
          fi
      - name: Install nightly with Miri and Clippy
        run: |
          rustup toolchain install nightly --component miri,clippy
          rustup override set nightly
          cargo miri setup
          rustup override set stable
      - name: Install fmt
        run: rustup component add rustfmt
      - name: Check formatting
        run: cargo fmt -- --check
      - name: Run clippy (half feature family)
        run: cargo +nightly clippy --all-targets --features "alloc,simd"
      - name: Run clippy (nightly_f16 feature family)
        run: cargo +nightly clippy --all-targets --no-default-features --features "std,alloc,simd,nightly_f16"
      - name: Build
        run: cargo check --verbose
      - name: Run tests
        run: cargo test --verbose
      - name: Run tests (nightly_f16 feature family)
        run: cargo +nightly test --no-default-features --features "std,nightly_f16"
      - name: Run Miri (half feature family)
        run: cargo +nightly miri test --all-targets --features "alloc,simd"
      - name: Run Miri (nightly_f16 feature family)
        run: cargo +nightly miri test --all-targets --no-default-features --features "std,alloc,simd,nightly_f16"
      - name: Build no_std
        run: cargo check --verbose --no-default-features
      - name: Build alloc
        run: cargo check --verbose --no-default-features --features="alloc"
      - name: Build no_std nightly_f16
        run: cargo +nightly check --verbose --no-default-features --features "nightly_f16"
      - name: Check semver # Only run on one platform as it takes a while
        uses: obi1kenobi/cargo-semver-checks-action@v2
        with:
          rust-toolchain: stable
          feature-group: default-features
      - name: Clean up the repository
        run: rm -rfd semver-checks # Remove the semver-checks directory or we can't publish
      - name: Check that the CHANGELOG.md has been updated
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          if ! grep -q "## \[${{ github.ref_name }}\]" CHANGELOG.md; then
              echo "CHANGELOG.md does not contain a section for the current tag."
              exit 1
          fi
      - name: Create Release Notes
        if: startsWith(github.ref, 'refs/tags/')
        run: sed -n "/^## \[${{ github.ref_name }}\]/,/^## \[/p" CHANGELOG.md | sed '$d' > /tmp/release-notes.md
      - name: Check that the release notes are reasonable
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          if ! grep -q "## \[${{ github.ref_name }}\]" /tmp/release-notes.md; then
              echo "/tmp/release-notes.md does not contain a section for the current tag."
              exit 1
          fi
      - name: Creating Release on Github
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v2
        with:
          prerelease: false
          draft: false
          body_path: /tmp/release-notes.md