build(deps): Update Rust crate syn to v2.0.72 #1157
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- v* | |
pull_request: | |
branches: [ master ] | |
jobs: | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install fmt with stable toolchain | |
id: toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- run: rustup override set ${{steps.toolchain.outputs.name}} | |
- run: rustup component add rustfmt | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
clippy: | |
name: Clipply | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install clippy with stable toolchain | |
id: toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- run: rustup override set ${{steps.toolchain.outputs.name}} | |
- run: rustup component add clippy | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --locked --all-targets --all-features | |
min_version: | |
name: Minimum supported rust version | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Extract min supported rust version | |
shell: bash | |
run: | | |
echo "MIN_SUPPORTED_RUST_VERSION=$(sed -n 's/^rust-version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) | |
id: toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} | |
- run: rustup override set ${{steps.toolchain.outputs.name}} | |
- run: rustup component add clippy | |
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --locked --all-targets --all-features | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --locked | |
- name: Run examples | |
run: | | |
cp target/debug/rash /usr/local/bin/rash | |
make test-examples | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
# cross minimum glibc version is 2.32 | |
- { os: ubuntu-22.04, target: arm-unknown-linux-gnueabihf, use-cross: true } | |
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, use-cross: true } | |
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl, use-cross: true } | |
# use ubuntu 20.04 to keep minimum glibc version to 2.31 | |
- { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu} | |
- { os: macos-12, target: x86_64-apple-darwin} | |
name: (${{ matrix.job.os }}) ${{ matrix.job.target }} | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install prerequisites | |
shell: bash | |
run: | | |
case ${{ matrix.job.target }} in | |
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; | |
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
esac | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# not reuse cache between different targets: | |
# https://github.com/cross-rs/cross/issues/39#issuecomment-270684223 | |
key: ${{ matrix.job.target }} | |
- name: Install Rust toolchain | |
id: toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.job.target }} | |
- run: rustup override set ${{steps.toolchain.outputs.name}} | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.job.use-cross }} | |
command: test | |
args: --locked --target=${{ matrix.job.target }} | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=rash" >> $GITHUB_ENV | |
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Install UPX | |
uses: crazy-max/ghaction-upx@v3 | |
with: | |
install-only: true | |
version: latest | |
if: matrix.job.os != 'macos-12' | |
- name: Make release | |
id: package | |
shell: bash | |
run: | | |
export CARGO_TARGET=${{ matrix.job.target }} | |
export CARGO_USE_CROSS=${{ matrix.job.use-cross }} | |
export PKG_BASE_NAME=${PROJECT_NAME}-${PROJECT_VERSION}-${CARGO_TARGET} | |
make release | |
echo "::set-output name=PKG_BASE_NAME::${PKG_BASE_NAME}" | |
- name: Publish crates | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
shell: bash | |
run: | | |
cargo login "${CRATES_IO_TOKEN}" | |
make publish | |
- name: Get Changelog Entry | |
if: startsWith(github.ref, 'refs/tags/') | |
id: changelog_reader | |
uses: mindsers/[email protected] | |
with: | |
version: v${{ env.PROJECT_VERSION }} | |
path: ./CHANGELOG.md | |
- name: Publish | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} | |
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} | |
files: | | |
${{ steps.package.outputs.PKG_BASE_NAME }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |