build(deps): bump taiki-e/install-action from 2.45.5 to 2.45.13 (#500) #1103
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: 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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | |
id: filter | |
with: | |
filters: | | |
bash: | |
- '**/*.sh' | |
markdown: | |
- 'src/cli.rs' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- 'TEMPLATE.md' | |
- 'rust-toolchain.toml' | |
python: | |
- '**/*.py' | |
- '.github/workflows/requirements.txt' | |
rust: | |
- '**/*.rs' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
- 'rust-toolchain.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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: check cache | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | |
id: cache | |
with: | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
target/ | |
key: ${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
- 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: | | |
make rust_docs | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: setup python | |
run: | | |
set -x | |
python3 -m venv .venv | |
.venv/bin/pip install -r .github/workflows/requirements.txt | |
- name: ruff python | |
run: | | |
set -x | |
md=".github/workflows/md.py" | |
.venv/bin/ruff check -v "$md" | |
.venv/bin/ruff format --check -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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: check cache | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | |
id: cache | |
with: | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
target/ | |
key: ${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
- name: install cargo-tarpaulin | |
uses: taiki-e/install-action@a22e1808bbd53573c0b897cc089c64643401af7d | |
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@331f8f5b4215f0445d3c07b4967662a32a2d3e31 | |
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@e9a478b16159b4d31420099ba146cdc50f134483 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: check cache | |
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | |
id: cache | |
with: | |
path: | | |
~/.cargo/ | |
~/.rustup/ | |
target/ | |
key: ${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }} | |
- name: cargo build | |
run: | | |
cargo build --locked | |
- name: update readme | |
run: .github/workflows/md.py | |
- name: commit readme | |
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 | |
with: | |
message: 'build(README): render from TEMPLATE' | |
add: 'README.md' |