CI: linting

This commit is contained in:
realaravinth 2021-04-09 22:58:23 +05:30
parent d3851ea38e
commit 217cdcab5b
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
4 changed files with 99 additions and 20 deletions

42
.github/workflows/clippy-fmt.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Lint
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Check with rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- name: Check with Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --tests --all-features

View file

@ -101,29 +101,10 @@ jobs:
# panicking
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61
OPEN_API_DOCS: 8e77345f1597e40c2e266cb4e6dee74888918a61
CACHE_BUSTER_FILE_MAP: '{"map":{"./static/bundle/main.js":"./prod/bundle/main.1417115E59909BE0A01040A45A398ADB09D928DF89CCF038FA44B14850442096.js"},"base_dir":"./prod"}'
- name: Upload to Codecov
if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
uses: codecov/codecov-action@v1
with:
file: cobertura.xml
- name: generate documentation
if: matrix.version == 'stable' && (github.repository == 'mCaptcha/guard')
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --workspace --all-features
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
OPEN_API_DOCS: 8e77345f1597e40c2e266cb4e6dee74888918a61
- name: Deploy to GitHub Pages
if: matrix.version == 'stable' && (github.repository == 'mCaptcha/guard')
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc

34
.github/workflows/upload-doc.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: Upload Documentation
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: generate documentation
if: github.repository == 'mCaptcha/guard'
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --workspace --all-features
- name: Deploy to GitHub Pages
if: github.repository == 'mCaptcha/guard'
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: target/doc

View file

@ -25,3 +25,25 @@ pub fn services(cfg: &mut ServiceConfig) {
cfg.service(auth::register::join);
cfg.service(panel::panel);
}
//#[cfg(not(tarpaulin_include))]
//#[cfg(test)]
//mod tests {
// use actix_web::http::StatusCode;
// use actix_web::test;
//
// use super::*;
// use crate::*;
//
// #[actix_rt::test]
// async fn templates_work() {
// let mut app = test::init_service(App::new().configure(services)).await;
// let urls = vec!["/", "/join", "/panel"];
//
// for url in urls.iter() {
// let resp =
// test::call_service(&mut app, test::TestRequest::get().uri(url).to_request()).await;
// assert_eq!(resp.status(), StatusCode::OK);
// }
// }
//}