Skip to content

Jq rule composition - workflow for async getters (#642) #183

Jq rule composition - workflow for async getters (#642)

Jq rule composition - workflow for async getters (#642) #183

Workflow file for this run

name: Post Merge
on:
push:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
update_code_coverage_threshold:
name: Generate Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --cobertura --output-path coverage.cobertura.xml
- uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: 20
- run: |
CURRENT_COVERAGE=$(grep '<coverage' coverage.cobertura.xml | grep -o 'line-rate="[0-9.]\+"' | grep -o '[0-9.]\+')
CURRENT_COVERAGE=$(printf %.0f $(echo "$CURRENT_COVERAGE*100" | bc))
CURRENT_LOWER_THRESHOLD=$(echo "$CURRENT_COVERAGE-2" | bc)
CURRENT_UPPER_THRESHOLD=$(echo "$CURRENT_COVERAGE+2" | bc)
echo "CURRENT_LOWER_THRESHOLD=$CURRENT_LOWER_THRESHOLD" >> $GITHUB_ENV
echo "CURRENT_UPPER_THRESHOLD=$CURRENT_UPPER_THRESHOLD" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: locked_actions_branch
- name: read threshold file into environment variable
run: |
LOWER_COVERAGE_THRESHOLD=$(cat ./ci/coverage_threshold.txt | cut -d ' ' -f1)
echo "LOWER_COVERAGE_THRESHOLD=$LOWER_COVERAGE_THRESHOLD" >> $GITHUB_ENV
- name: commit threshold changes
if: ${{ fromJSON(env.CURRENT_LOWER_THRESHOLD) > fromJSON(env.LOWER_COVERAGE_THRESHOLD) }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
rm ./ci/coverage_threshold.txt
echo "${{ env.CURRENT_LOWER_THRESHOLD }} ${{ env.CURRENT_UPPER_THRESHOLD }} " > ./ci/coverage_threshold.txt
git add ./ci/coverage_threshold.txt
git commit -m "chore: git bot update threshold"
- name: push changes
uses: ad-m/github-push-action@master
with:
branch: locked_actions_branch
continue-on-error: true