Skip to content

Merge pull request #28 from Arrow-air/owlot/dw-1308/svc-template-rust… #113

Merge pull request #28 from Arrow-air/owlot/dw-1308/svc-template-rust…

Merge pull request #28 from Arrow-air/owlot/dw-1308/svc-template-rust… #113

Workflow file for this run

## DO NOT EDIT!
# This file was provisioned by Terraform
# File origin: https://github.com/Arrow-air/tf-github/tree/main/src/templates/rust-all/.github/workflows/rust_ci.yml
on:
push:
branches:
- develop
- main
paths:
- "**/*.rs"
- "Cargo.lock"
- "**/Cargo.toml"
pull_request:
branches:
- develop
- main
paths:
- "**/*.rs"
- "Cargo.lock"
- "**/Cargo.toml"
name: Rust Checks
env:
TERM: xterm
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make rust-fmt
check:
name: Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- run: make rust-check
build:
name: Build
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- run: make rust-build
- name: Cache .env file for next jobs
uses: actions/cache/save@v3
id: cache
with:
path: .env
key: dot-env-${{ github.run_id }}
test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- name: Get .env file from cache
uses: actions/cache/restore@v3
with:
path: .env
key: dot-env-${{ github.run_id }}
- name: Test
run: make rust-test
clippy:
name: Clippy
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- run: make rust-clippy
# Validates the code examples in doc comments
doc:
name: Rustdoc
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- run: make rust-doc
coverage:
name: Unit Test Coverage
needs: build
runs-on: ubuntu-latest
env:
NODE_COVERALLS_DEBUG: 1
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "rust-ci"
cache-directories: "${{ github.workspace }}/.cargo"
- name: Get .env file from cache
uses: actions/cache/restore@v3
with:
path: .env
key: dot-env-${{ github.run_id }}
- run: |
mkdir -p coverage
make rust-ut-coverage | tee coverage/ut.txt
echo UT_COV=$(sed '/||/,$!d' coverage/ut.txt) >> $GITHUB_ENV
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage/lcov.info
base-path: .
- uses: thollander/actions-comment-pull-request@v1
continue-on-error: true
with:
message: |
:beetle: Unit Testing Coverage :mag_right:
${{ env.UT_COV }}
:point_right: [View in Coveralls.io](https://coveralls.io/github/${{ github.repository }}) :point_left:
comment_includes: ':beetle: Unit Testing Coverage :mag_right:'