Skip to content

Document positional arguments in --help output #110

Document positional arguments in --help output

Document positional arguments in --help output #110

Workflow file for this run

# This file is part of the rust-for-it project.
#
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
# SPDX-License-Identifier: MIT
name: Build and test
on:
pull_request:
push:
schedule:
- cron: '0 16 * * 5' # Every Friday 4pm
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build_and_test:
name: Build and test
strategy:
fail-fast: false
matrix:
runs-on: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
env:
RUSTFLAGS: "-Cinstrument-coverage -D warnings"
steps:
- name: Check out
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Build
run: |-
set -x
rustc --version --verbose
cargo build
cargo build --tests
- name: Check whether Cargo.lock is in sync
run: |-
git diff --exit-code -- Cargo.lock # non-empty diff fails CI
- name: Test
run: |-
cargo test
- name: Smoke test CLI
run: |-
set -x
cargo run -- --version
cargo run -- --help
! cargo run -- --strict -t1 -s google.com:1234 -- true
! cargo run -- --strict -t1 -s somewhere.invalid:80 -- true
cargo run -- -t0 -s google.com:80 -- echo 'Google is up'
- name: Install coverage tools
if: runner.os == 'Linux'
run: |-
set -x
# Install grcov
wget https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2
tar xf grcov-x86_64-unknown-linux-gnu.tar.bz2
chmod a+x grcov
mkdir -p ~/.local/bin/
mv grcov ~/.local/bin/
echo "${USER}/.local/bin/" >> "${GITHUB_PATH}"
# Install lcov + llvm for llvm-profdata
sudo apt-get update
sudo apt-get install --yes --no-install-recommends -V \
lcov \
llvm
- name: Render coverage report
if: runner.os == 'Linux'
run: |-
set -x
grcov_args=(
--binary-path target/debug
--source-dir src
--ignore '/*'
--branch
# grcov needs help finding llvm-profdata, apparently
--llvm-path "$(dirname "$(which llvm-profdata)")"
)
grcov "${grcov_args[@]}" -t html -o target/coverage/html .
grcov "${grcov_args[@]}" -t lcov -o target/coverage/lcov .
lcov --list target/coverage/lcov 2>/dev/null \
| tee target/coverage/summary.txt
- name: Store coverage report
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: runner.os == 'Linux'
with:
name: coverage_${{ matrix.runs-on }}_${{ github.sha }}
path: target/coverage/
if-no-files-found: error