jdrouet/mrml

View on GitHub
.github/workflows/mrml-cli-main.yml

Summary

Maintainability
Test Coverage
name: mrml-cli

on:
  merge_group:
    types: [checks_requested]
  workflow_call:
  pull_request:
    paths:
      - ".github/workflows/mrml-cli-main.yml"
      - "Cargo.lock"
      - "Cargo.toml"
      - "packages/mrml-cli/**"
      - "packages/mrml-core/**"
  push:
    branches:
      - main
    paths:
      - ".github/workflows/mrml-cli-main.yml"
      - "Cargo.lock"
      - "Cargo.toml"
      - "packages/mrml-cli/**"
      - "packages/mrml-core/**"

env:
  RUSTFLAGS: "-Dwarnings"

jobs:
  testing:
    runs-on: ubuntu-latest
    concurrency:
      group: ${{ github.ref }}-mrml-cli-testing
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v4

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal

      - uses: actions/cache@v4
        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
    concurrency:
      group: ${{ github.ref }}-mrml-cli-building
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: jdrouet/action-git-metrics@install
      - uses: jdrouet/action-git-identity@main

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal

      - uses: actions/cache@v4
        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: getting binary size
        id: binary-size
        run: echo value=$(stat --printf="%s" ./target/release/mrml) >> $GITHUB_OUTPUT

      - name: exporting git metrics
        uses: jdrouet/action-git-metrics@execute
        continue-on-error: true
        with:
          pull: true
          push: ${{ github.event_name == 'push' }}
          script: |
            add binary-size --tag "name: mrml-cli" --tag "platform.os: linux" --tag "platform.arch: x86_64" ${{ steps.binary-size.outputs.value }}

      - uses: jdrouet/action-git-metrics@check
        continue-on-error: true