Skip to content

Bump the cargo_dependencies group with 4 updates #154

Bump the cargo_dependencies group with 4 updates

Bump the cargo_dependencies group with 4 updates #154

Workflow file for this run

on:
workflow_dispatch:
pull_request:
push:
branches: [ "master" ]
schedule:
# Run at 8 AM, on sundays
- cron: '0 8 * * 0'
name: CI
env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
RUST_BACKTRACE: 1
jobs:
check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["aarch64-apple-darwin",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"arm-unknown-linux-musleabihf",
"armv7-unknown-linux-musleabihf",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-pc-windows-msvc"]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --target ${{ matrix.target }} --all-targets
typos:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check spelling of entire workspace
uses: crate-ci/[email protected]
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
build-test:
name: Test Suite (native)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-2022]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build
- run: cargo test --workspace
cross-build-test:
name: Test Suite (Cross)
env:
CROSS_VERSION: v0.2.5
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["aarch64-unknown-linux-musl",
"arm-unknown-linux-musleabihf",
"armv7-unknown-linux-musleabihf"]
steps:
- uses: actions/checkout@v4
- name: Install Cargo Cross
run: |
curl -LO "https://github.com/cross-rs/cross/releases/download/${{ env.CROSS_VERSION }}/cross-x86_64-unknown-linux-musl.tar.gz"
tar xf cross-x86_64-unknown-linux-musl.tar.gz
- name: Build ${{ matrix.target }}
run: ./cross build --verbose --workspace --target ${{ matrix.target }}
- name: Test ${{ matrix.target }}
run: ./cross test --verbose --workspace --target ${{ matrix.target }}
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace -- -D warnings -W clippy::all
tag-release:
needs: [check, typos, audit, build-test, cross-build-test, format, lint]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
permissions:
contents: write
outputs:
new_tag_created: ${{ steps.create_tag.outputs.new_tag_created }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_WITH_REPO_SCOPE }}
- name: Get version from Cargo.toml
run: |
VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if tag exists
run: |
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Create and push tag
id: create_tag
if: env.TAG_EXISTS == 'false'
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git tag -a "v${{ env.VERSION }}" -m "Release v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
echo "new_tag_created=true" >> $GITHUB_OUTPUT
release-crates-io:
needs: tag-release
if: needs.tag-release.outputs.new_tag_created == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_PUBLISH_TOKEN }}