Skip to content

Commit

Permalink
ci: add github action build
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Nov 7, 2021
1 parent f5e0b6a commit 2fa32e6
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 6 additions & 0 deletions grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
branch: true
ignore-not-existing: true
llvm: true
filter: covered
output-type: lcov
output-path: ./target/lcov.info

0 comments on commit 2fa32e6

Please sign in to comment.