diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6b8f0d1..25251b2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -40,7 +40,13 @@ "panicbit.cargo", "editorconfig.editorconfig", "mhutchie.git-graph", - "rust-lang.rust" + "rust-lang.rust", + "donjayamanne.githistory", + "hashhar.gitattributes", + "codezombiech.gitignore", + "eamodio.gitlens", + "knisterpeter.vscode-commitizen", + "github.vscode-pull-request-github" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f5f13f5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,103 @@ +name: Rust + +on: + push: + pull_request: + branches: [ master, develop ] +env: + CARGO_TERM_COLOR: always + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + rust: [stable,beta,nightly,1.31.0] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + + - uses: actions-rs/cargo@v1 + with: + command: test + args: --release --all-features + bench: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + + - uses: actions-rs/install@v0.1 + with: + crate: cargo-criterion + + - uses: actions-rs/cargo@v1 + with: + command: criterion + args: --all-features + + coverage: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast + env: + CARGO_INCREMENTAL: '0' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + - uses: actions-rs/grcov@v0.1 + id: coverage + with: + config: grcov.yml + + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ${{ steps.coverage.outputs.report }} + flag-name: run-${{ matrix.os }} + parallel: true + - uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ steps.coverage.outputs.report }} + flags: run-${{ matrix.os }} + verbose: true + + finish: + needs: coverage + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..ebec2aa --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,35 @@ +name: Rust Linting + +on: + push: + paths: + - '**/*.rs' + - '**/Cargo.toml' + branches-ignore: + - dependabot/* + pull_request: + branches: [ master, develop ] +jobs: + clippy_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: rustup component add clippy + - uses: actions-rs/clippy-check@v1 + if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + - uses: actions-rs/cargo@v1 + if: github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' + with: + command: clippy + args: all-targets -- -D warnings + formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..a4c7f05 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,20 @@ + +name: Cargo Audit Scanning +on: + push: + paths: + - "**/Cargo.toml" + - "**/Cargo.lock" + schedule: + - cron: "0 14 * * *" # 14:00 UTC +jobs: + cargo-audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/audit-check@v1 + # Don't run on dependabot PRs or forks + # https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807852653 + if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/grcov.yml b/grcov.yml new file mode 100644 index 0000000..dae5f11 --- /dev/null +++ b/grcov.yml @@ -0,0 +1,6 @@ +branch: true +ignore-not-existing: true +llvm: true +filter: covered +output-type: lcov +output-path: ./target/lcov.info