Skip to content

Update actions/checkout to v5 #143

Update actions/checkout to v5

Update actions/checkout to v5 #143

Workflow file for this run

name: ci
on:
workflow_dispatch:
push:
branches:
- "main"
- "v[0-9]+.[0-9]+.x"
tags:
- "v*"
pull_request:
branches:
- "main"
- "v[0-9]+.[0-9]+.x"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
format_check:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: actions/checkout@v5
- run: cargo fmt -- --check
lint_check:
name: Check clippy warnings
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: actions/checkout@v5
- run: cargo clippy --all-targets --all-features -- -Dwarnings
build:
name: ${{ matrix.job.target }} (${{ matrix.features.name }})
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04-arm }
- { target: i686-pc-windows-msvc, os: windows-latest }
- { target: i686-unknown-linux-gnu, os: ubuntu-latest, use-cross: true }
- { target: x86_64-apple-darwin, os: macos-13 }
- { target: x86_64-pc-windows-gnu, os: windows-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
features:
- { name: "std", extra_args: "--features serde" }
- { name: "no_std", extra_args: "--no-default-features --features serde" }
env:
CARGO_CMD: cargo
steps:
- name: Checkout source code
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Use cross as the cargo command
if: matrix.job.use-cross
shell: bash
run: echo "CARGO_CMD=cross" >> $GITHUB_ENV
- name: Build
shell: bash
run: |
$CARGO_CMD build --release --target=${{ matrix.job.target }} ${{matrix.features.extra_args}}
- name: Test
shell: bash
run: $CARGO_CMD test --target=${{ matrix.job.target }} ${{matrix.features.extra_args}}
release:
name: Publish release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: build
steps:
- name: Checkout source
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Extract changelog section
id: changelog
shell: bash
run: |
CI_WORKDIR=ci-workdir
BODY_PATH=${CI_WORKDIR}/body.md
mkdir "${CI_WORKDIR}"
python3 scripts/changelog.py -o "${BODY_PATH}"
echo "body_path=${BODY_PATH}" >> $GITHUB_OUTPUT
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: ${{ steps.changelog.outputs.body_path }}
- name: Publish crate
shell: bash
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
run:
cargo publish