Skip to content

build(Cargo.toml): bump rust from 1.71 to 1.72 #637

build(Cargo.toml): bump rust from 1.71 to 1.72

build(Cargo.toml): bump rust from 1.71 to 1.72 #637

Workflow file for this run

---
name: CI
"on":
push:
branches:
- master
pull_request:
branches:
- master
jobs:
pre_ci:
name: pre ci
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions: {}
outputs:
repo: ${{ steps.repo.outputs.repo }}
steps:
- name: get repo name
id: repo
run: |
REPO_NAME="${GITHUB_REPOSITORY#"$GITHUB_REPOSITORY_OWNER/"}"
echo "Repo: ${REPO_NAME}"
echo "repo=${REPO_NAME}" >> "$GITHUB_OUTPUT"
changes:
name: filter changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
bash: ${{ steps.filter.outputs.bash }}
markdown: ${{ steps.filter.outputs.markdown }}
python: ${{ steps.filter.outputs.python }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
id: filter
with:
filters: |
bash:
- '**/*.sh'
markdown:
- 'src/cli.rs'
- 'Cargo.lock'
- 'Cargo.toml'
- 'TEMPLATE.md'
python:
- '**/*.py'
- '.github/workflows/requirements.txt'
rust:
- '**/*.rs'
- 'Cargo.lock'
- 'Cargo.toml'
lint_rs:
name: lint rust ci
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: check cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: cache
with:
path: |
~/.cargo/
~/.rustup/
target/
key: ${{ runner.os }}-rust-all-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}
- name: install rust toolchain
if: steps.cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt, rust-docs
- name: cargo fmt check
run: |
cargo fmt -- --check --verbose
- name: cargo clippy main
run: |
cargo clippy --locked --workspace
- name: cargo clippy tests
run: |
cargo clippy --locked --tests
- name: cargo rustdoc
run: |
cargo rustdoc
lint_py:
name: lint python ci
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: setup python
run: |
set -x
python3 -m venv .venv
.venv/bin/pip install -r .github/workflows/requirements.txt
- name: black/ruff python
run: |
set -x
md=".github/workflows/md.py"
.venv/bin/black -v "$md"
.venv/bin/ruff -v "$md"
lint_sh:
name: lint bash ci
needs: changes
if: ${{ needs.changes.outputs.bash == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: shellcheck bash
run: |
shopt -s globstar
shellcheck -s bash ./*.sh .github/**/*.sh
test:
name: test ci
needs: lint_rs
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
outputs:
coverage: ${{ steps.coverage.outputs.coverage }}
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: check cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: cache
with:
path: |
~/.cargo/
~/.rustup/
target/
key: ${{ runner.os }}-rust-all-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}
- name: install rust toolchain
if: steps.cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt, rust-docs
- name: install cargo-tarpaulin
uses: taiki-e/install-action@ba7482c6af6681ab4e26be5ea509d1e8f7cf6816
with:
tool: cargo-tarpaulin
checksum: true
- name: cargo test coverage
run: |
cargo tarpaulin --locked --tests --line -o xml --exclude-files src/cli.rs src/main.rs
- name: report (total lines) coverage
if: ${{ (github.event_name == 'push') && !(startsWith(github.event.head_commit.message, 'build(deps):')) }}
id: coverage
run: |
COVERAGE="$(grep -E -o 'line-rate="[^"]+"' cobertura.xml \
| head -1 | cut -d\" -f2 | awk '{print int($0*100+0.5)}')"
echo "coverage=${COVERAGE}" >> "$GITHUB_OUTPUT"
- name: cov summary md
if: ${{ (github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]') }}
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95
with:
filename: cobertura.xml
format: 'markdown'
hide_complexity: true
hide_branch_rate: true
output: both
- name: cov pr comment
if: ${{ (github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]') }}
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd
with:
message: Coverage Report
recreate: true
path: code-coverage-results.md
badge:
name: coverage badge
needs:
- pre_ci
- test
if: ${{ (github.event_name == 'push') && !(startsWith(github.event.head_commit.message, 'build(deps):')) }}
runs-on: ubuntu-latest
permissions: {}
env:
gist_id: 0e20cd331d0800e3299298a3868aab7a
steps:
- name: generate dynamic badge
uses: schneegans/dynamic-badges-action@5d424ad4060f866e4d1dab8f8da0456e6b1c4f56
with:
auth: ${{ secrets.GIST_TOKEN }}
filename: ${{ needs.pre_ci.outputs.repo }}__${{ github.ref_name }}.json
gistID: ${{ env.gist_id }}
label: coverage
message: ${{ needs.test.outputs.coverage }}%
namedLogo: github
style: flat-square
valColorRange: ${{ needs.test.outputs.coverage }}
maxColorRange: 100
minColorRange: 0
- name: badge image url
run: |
URL="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/${{ github.actor }}/${{ env.gist_id }}/raw/${{ needs.pre_ci.outputs.repo }}__${{ github.ref_name }}.json"
MARKDOWN="![Coverage](${URL})"
echo "Badge URL: ${URL}"
echo "Badge image for Markdown: ${MARKDOWN}"
md:
name: update readme
needs: changes
if: ${{ (github.event_name == 'push') && !(startsWith(github.event.head_commit.message, 'build(deps):')) && (needs.changes.outputs.markdown == 'true') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout project
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: check cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: cache
with:
path: |
~/.cargo/
~/.rustup/
target/
key: ${{ runner.os }}-rust-all-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}
- name: install rust toolchain
if: steps.cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt, rust-docs
- name: cargo build
run: |
cargo build --locked
- name: update readme
run: .github/workflows/md.py
- name: commit readme
uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081
with:
message: 'build(README): render from TEMPLATE'
add: 'README.md'