Skip to content

Commit eb49fd1

Browse files
committed
chore: Update .github/workflows/code-coverage.yaml in artichoke/strftime-ruby
Managed by Terraform. ## Contents ``` --- name: Code Coverage "on": push: branches: - trunk pull_request: branches: - trunk jobs: generate: name: Generate permissions: id-token: write contents: read runs-on: ubuntu-latest env: RUST_BACKTRACE: 1 CARGO_NET_GIT_FETCH_WITH_CLI: true steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: toolchain: nightly profile: minimal override: true components: llvm-tools-preview - name: Setup grcov run: | release_url="$(curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/mozilla/grcov/releases | \ jq -r '.[0].assets | map(select(.browser_download_url | test(".*x86_64-unknown-linux-musl.tar.bz2$"))) | .[0].browser_download_url')" curl -sL "$release_url" | sudo tar xvj -C /usr/local/bin/ - name: Generate coverage env: LLVM_PROFILE_FILE: "strftime-ruby-%m.profraw" RUSTFLAGS: "-C instrument-coverage" # Unstable feature: rust-lang/rust#56925 RUSTDOCFLAGS: "-C instrument-coverage -Z unstable-options --persist-doctests target/debug/doctests" run: | cargo +nightly test --lib cargo +nightly test --doc - name: Generate HTML report run: grcov strftime-ruby*.profraw --source-dir . --binary-path target/debug -t html --filter covered -o target/coverage - name: Generate detailed JSON report run: grcov strftime-ruby*.profraw --source-dir . --binary-path target/debug -t covdir --filter covered -o target/coverage/coverage.json - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@master if: github.ref == 'refs/heads/trunk' with: aws-region: us-west-2 role-to-assume: arn:aws:iam::447522982029:role/gha-strftime-ruby-s3-backup-20220817011212567800000002 role-session-name: GitHubActionsRustCodeCoverage@strftime-ruby - name: Show AWS caller identity if: github.ref == 'refs/heads/trunk' run: aws sts get-caller-identity - name: Upload archives to S3 if: github.ref == 'refs/heads/trunk' run: | aws s3 sync target/coverage/ s3://artichoke-forge-code-coverage-us-west-2/strftime-ruby/ --delete --sse AES256 --exclude '*' --include '*.svg' --content-type 'image/svg+xml' aws s3 sync target/coverage/ s3://artichoke-forge-code-coverage-us-west-2/strftime-ruby/ --delete --sse AES256 --exclude '*' --include '*.html' --content-type 'text/html' aws s3 sync target/coverage/ s3://artichoke-forge-code-coverage-us-west-2/strftime-ruby/ --delete --sse AES256 --exclude '*' --include '*.json' --content-type 'application/json' aws s3 sync target/coverage/ s3://artichoke-forge-code-coverage-us-west-2/strftime-ruby/ --delete --sse AES256 --include '*' --exclude '*.svg' --exclude '*.html' --exclude '*.json' - name: Check missed lines run: | curl -s https://codecov.artichokeruby.org/strftime-ruby/coverage.json | python -c '\ import sys, json; \ \ trunk_coverage = json.loads(sys.stdin.read()); \ print("On trunk: "); \ print("coveragePercent =", trunk_coverage["coveragePercent"]); \ print("linesCovered =", trunk_coverage["linesCovered"]); \ print("linesMissed =", trunk_coverage["linesMissed"]); \ print("linesTotal =", trunk_coverage["linesTotal"]); \ print(""); \ \ branch_coverage = json.load(open("target/coverage/coverage.json")) print("On PR branch: "); \ print("coveragePercent =", branch_coverage["coveragePercent"]); \ print("linesCovered =", branch_coverage["linesCovered"]); \ print("linesMissed =", branch_coverage["linesMissed"]); \ print("linesTotal =", branch_coverage["linesTotal"]); \ print(""); \ \ is_ok = branch_coverage["linesMissed"] <= trunk_coverage["linesMissed"]; \ exit(0) if is_ok else exit(1) \ ' ```
1 parent ccc8245 commit eb49fd1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/code-coverage.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
4141
- name: Generate coverage
4242
env:
43-
LLVM_PROFILE_FILE: "strftime-%m.profraw"
43+
LLVM_PROFILE_FILE: "strftime-ruby-%m.profraw"
4444
RUSTFLAGS: "-C instrument-coverage"
4545
# Unstable feature: https://github.com/rust-lang/rust/issues/56925
4646
RUSTDOCFLAGS: "-C instrument-coverage -Z unstable-options --persist-doctests target/debug/doctests"
@@ -49,18 +49,18 @@ jobs:
4949
cargo +nightly test --doc
5050
5151
- name: Generate HTML report
52-
run: grcov strftime*.profraw --source-dir . --binary-path target/debug -t html --filter covered -o target/coverage
52+
run: grcov strftime-ruby*.profraw --source-dir . --binary-path target/debug -t html --filter covered -o target/coverage
5353

5454
- name: Generate detailed JSON report
55-
run: grcov strftime*.profraw --source-dir . --binary-path target/debug -t covdir --filter covered -o target/coverage/coverage.json
55+
run: grcov strftime-ruby*.profraw --source-dir . --binary-path target/debug -t covdir --filter covered -o target/coverage/coverage.json
5656

5757
- name: Configure AWS Credentials
5858
uses: aws-actions/configure-aws-credentials@master
5959
if: github.ref == 'refs/heads/trunk'
6060
with:
6161
aws-region: us-west-2
6262
role-to-assume: arn:aws:iam::447522982029:role/gha-strftime-ruby-s3-backup-20220817011212567800000002
63-
role-session-name: GitHubActionsSession@codecov
63+
role-session-name: GitHubActionsRustCodeCoverage@strftime-ruby
6464

6565
- name: Show AWS caller identity
6666
if: github.ref == 'refs/heads/trunk'

0 commit comments

Comments
 (0)