ci(github): report mrml-cli metric to codebench (#321) #43
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
on: | |
push: | |
paths: | |
- .github/workflows/mrml-cli-* | |
- packages/mrml-cli/** | |
- packages/mrml-core/** | |
- Cargo.lock | |
- Cargo.toml | |
env: | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
testing: | |
runs-on: ubuntu-latest | |
container: rust:1-bullseye | |
concurrency: | |
group: ${{ github.ref }}-mrml-cli-testing | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-testing-${{ hashFiles('**/Cargo.lock') }} | |
- name: run tests | |
run: cargo test -p mrml-cli | |
building: | |
runs-on: ubuntu-latest | |
container: rust:1-bullseye | |
concurrency: | |
group: ${{ github.ref }}-mrml-cli-building | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-testing-${{ hashFiles('**/Cargo.lock') }} | |
- name: building the cli binary | |
run: cargo build --package mrml-cli --release | |
- name: publish file size metric | |
run: | | |
FILE_SIZE=$(du -sb target/release/mrml | awk '{ print $1 }') | |
curl https://codebench.cloud/binaries/codebench-cli-amd64 -o ./codebench-cli | |
chmod +x ./codebench-cli | |
TOKEN=${{ secrets.CODEBENCH_TOKEN }} ./codebench-cli publish --branch-name $GITHUB_REF_NAME --commit-hash $GITHUB_SHA --parameters unit=byte mrml-cli.binary.size gauge $FILE_SIZE |