Merge branch 'more-checks' into 'main'

Nouvelle CI permettant de faire plus de tests

See merge request CoCo_Sol/border-wars!9
This commit is contained in:
CoCo_Sol 2023-05-27 17:34:10 +02:00
commit 1541319d3f
2 changed files with 74 additions and 2 deletions

View file

@ -1,13 +1,66 @@
stages: stages:
- checks - checks
- build
cargo-test: cargo-test:
image: rust:latest
stage: checks
before_script:
- apt-get update && apt-get install libasound2-dev libudev-dev -y
script:
- cargo test --workspace
rules:
- exists:
- Cargo.toml
cargo-clippy:
image: rust:latest image: rust:latest
stage: checks stage: checks
before_script: before_script:
- apt-get update && apt-get install libasound2-dev libudev-dev -y - apt-get update && apt-get install libasound2-dev libudev-dev -y
- rustup component add clippy - rustup component add clippy
script: script:
- rustc --version && cargo --version
- cargo clippy --workspace - cargo clippy --workspace
- cargo test --workspace rules:
- exists:
- Cargo.toml
cargo-fmt:
image: rust:latest
stage: checks
before_script:
- rustup install nightly --profile minimal
- rustup component add rustfmt --toolchain nightly
script:
- cargo +nightly fmt --check
rules:
- exists:
- Cargo.toml
development-image:
image: docker:latest
stage: build
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
exists:
- Dockerfile
production-image:
image: docker:latest
stage: build
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
exists:
- Dockerfile

19
rustfmt.toml Normal file
View file

@ -0,0 +1,19 @@
use_try_shorthand = true
use_field_init_shorthand = true
use_small_heuristics = "Max"
version = "Two"
error_on_line_overflow = true
error_on_unformatted = true
format_code_in_doc_comments = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
imports_granularity = "Module"
group_imports = "StdExternalCrate"
normalize_doc_attributes = true
normalize_comments = true
wrap_comments = true