diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..4573684b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +liberapay: svartalf +patreon: svartalf +custom: ["https://svartalf.info/donate/", "https://www.buymeacoffee.com/svartalf"] diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 00000000..28b5a01f --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,20 @@ +name: Security audit + +on: + schedule: + - cron: '0 0 0 * *' + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + pull_request: + +jobs: + audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/audit-check@issue-104 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/clippy-ng.yml b/.github/workflows/clippy-ng.yml new file mode 100644 index 00000000..347a6821 --- /dev/null +++ b/.github/workflows/clippy-ng.yml @@ -0,0 +1,13 @@ +on: [push, pull_request] +name: Clippy (new version test, don't use it!) +jobs: + clippy_check_ng: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: clippy + override: true + - uses: actions-rs/clippy@master diff --git a/.github/workflows/clippy_check.yml b/.github/workflows/clippy_check.yml new file mode 100644 index 00000000..791d8be1 --- /dev/null +++ b/.github/workflows/clippy_check.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] +name: Clippy check +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: clippy + override: true + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cross_compile.yml b/.github/workflows/cross_compile.yml new file mode 100644 index 00000000..80e091d2 --- /dev/null +++ b/.github/workflows/cross_compile.yml @@ -0,0 +1,28 @@ +# We could use `@actions-rs/cargo` Action ability to automatically install `cross` tool +# in order to compile our application for some unusual targets. + +on: [push, pull_request] + +name: Cross-compile + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + target: + - armv7-unknown-linux-gnueabihf + - powerpc64-unknown-linux-gnu + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + override: true + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --release --target=${{ matrix.target }} diff --git a/.github/workflows/grcov.yml b/.github/workflows/grcov.yml new file mode 100644 index 00000000..6271155c --- /dev/null +++ b/.github/workflows/grcov.yml @@ -0,0 +1,66 @@ +on: [push, pull_request] + +name: Code coverage with grcov + +jobs: + grcov: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macOS-latest + - windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + profile: minimal + + - name: Execute tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" + + # Note that `actions-rs/grcov` Action can install `grcov` too, + # but can't use faster installation methods yet. + # As a temporary experiment `actions-rs/install` Action plugged in here. + # Consider **NOT** to copy that into your workflow, + # but use `actions-rs/grcov` only + - name: Pre-installing grcov + uses: actions-rs/install@v0.1 + with: + crate: grcov + use-tool-cache: true + + - name: Gather coverage data + id: coverage + uses: actions-rs/grcov@v0.1 + with: + coveralls-token: ${{ secrets.COVERALLS_TOKEN }} + + - name: Coveralls upload + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true + path-to-lcov: ${{ steps.coverage.outputs.report }} + + grcov_finalize: + runs-on: ubuntu-latest + needs: grcov + steps: + - name: Coveralls finalization + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml new file mode 100644 index 00000000..2addba6a --- /dev/null +++ b/.github/workflows/msrv.yml @@ -0,0 +1,110 @@ +# Based on https://github.com/actions-rs/meta/blob/master/recipes/msrv.md + +on: [push, pull_request] + +name: MSRV + +jobs: + check: + name: Check + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - 1.31.0 + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: check + + test: + name: Test Suite + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - 1.31.0 + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: Run cargo test + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: test + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - 1.31.0 + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: Install rustfmt + run: rustup component add rustfmt + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - 1.31.0 + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: Install clippy + run: rustup component add clippy + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: clippy + args: -- -D warnings \ No newline at end of file diff --git a/.github/workflows/nightly_lints.yml b/.github/workflows/nightly_lints.yml new file mode 100644 index 00000000..1dce957f --- /dev/null +++ b/.github/workflows/nightly_lints.yml @@ -0,0 +1,78 @@ +on: [push, pull_request] + +name: Nightly lints + +jobs: + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain with clippy available + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: clippy + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: clippy + args: -- -D warnings + + rustfmt: + name: Format + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain with rustfmt available + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: fmt + args: --all -- --check + + combo: + name: Clippy + rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: clippy + args: -- -D warnings + diff --git a/.github/workflows/quickstart.yml b/.github/workflows/quickstart.yml new file mode 100644 index 00000000..e9ad7c83 --- /dev/null +++ b/.github/workflows/quickstart.yml @@ -0,0 +1,79 @@ +# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md +# +# While our "example" application has the platform-specific code, +# for simplicity we are compiling and testing everything on the Ubuntu environment only. +# For multi-OS testing see the `cross.yml` workflow. + +on: [push, pull_request] + +name: Quickstart + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: check + + test: + name: Test Suite + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run cargo test + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: test + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true # WARNING: only for this example, remove it! + with: + command: clippy + args: -- -D warnings