Skip to content

refactor: reduce clone usage (#48) #757

refactor: reduce clone usage (#48)

refactor: reduce clone usage (#48) #757

Workflow file for this run

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
name: CI
jobs:
build_and_test:
name: Test and build on Linux
runs-on: ubuntu-latest
env:
RUST_LOG: debug # Output debug log
RUST_BACKTRACE: 1 # Dump backtrace on panic
DYNEIN_TEST_NO_DOCKER_SETUP: true
# define AWS credentials in environment for test
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
services:
dynamodb:
# Pinned to the version not to be broken with latest
image: amazon/dynamodb-local:2.2.1
ports:
- 8000:8000
- 8001:8000
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
run: |
rustup set profile minimal
rustup component add rustfmt clippy
- uses: Swatinem/rust-cache@640a22190e7a783d4c409684cea558f081f92012
# This is the most recent commit as of 2024-03-22.
# Also, it uses Node.js 20.
with:
shared-key: build-and-test
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run clippy check
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --no-fail-fast --all-features
- name: Build with release flag
run: cargo build --release --all-features
build_and_test_on_windows:
name: Test and build on Windows
runs-on: windows-2022
env:
RUST_LOG: debug # Output debug log
RUST_BACKTRACE: 1 # Dump backtrace on panic
DYNEIN_TEST_NO_DOCKER_SETUP: true
# define AWS credentials in environment for test
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
run: |
rustup set profile minimal
rustup component add rustfmt clippy
- uses: Swatinem/rust-cache@640a22190e7a783d4c409684cea558f081f92012
# This is the most recent commit as of 2024-03-22.
# Also, it uses Node.js 20.
with:
shared-key: build-and-test-on-windows
- name: Run tests for CLI
# Currently, we only conduct snapshot tests because GitHub Actions does not support containers in Windows.
run: cargo test cli_tests
- name: Build with release flag
run: cargo build --release --all-features
audit-latest:
name: Audit latest dependencies
runs-on: ubuntu-latest
env:
CARGO_AUDIT_BASE_FLAGS: --quiet -D warnings -D unmaintained -D unsound -D yanked
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install rust toolchain
run: rustup set profile minimal
- name: Install cargo audit
run: cargo install cargo-audit
- name: Run audit command
run: cargo audit ${{ env.CARGO_AUDIT_BASE_FLAGS }}
credentials-scan:
name: Credentials scan
runs-on: ubuntu-latest
steps:
- name: PR commits + 1
# Adding +1 to fetch a base commit
run: echo "fetch_depth=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
# Checkout pull request HEAD commit instead of merge commit
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.fetch_depth }}
- name: Secret Scanning
# v3.74.0
uses: trufflesecurity/trufflehog@ea4d9d2d32f45e77893ecb6338d7c6bd7cddb3ec
with:
extra_args: --no-verification
version: 3.74.0@sha256:7557cb2527b0c80dd5d7350b6bcd1f3a7c4baeeb158e67d6b0ee5d2b0942f151