From 7f43a12b9fe90a3da0de9373af10f4ec928b5892 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 17 May 2021 04:17:39 +0000 Subject: Update CI configuration and GitLab WebIDE settings --- .gitlab-ci.yml | 99 ++++++++++++++++++++++++++++++++++++++++++++++ .gitlab/.gitlab-webide.yml | 6 +++ src/database/redis/mod.rs | 2 +- 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab/.gitlab-webide.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..892325b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,99 @@ +cache: &global_cache + key: one-key-to-rule-them-all + paths: + - .cargo_home/registry/cache + - .cargo_home/registry/index + - .cargo_home/git/db + - target/debug/deps + - target/debug/incremental + - target/debug/build + +variables: + CARGO_HOME: .cargo_home + +stages: + - test + - build + - lint + +.deploy-production: + needs: ["test-rust-stable"] + cache: {} + script: + - echo "SSH to the target machine and deploy a NixOS container from this exact flake" + - echo "Not yet implemented" + - exit 1 + environment: + name: production + url: https://fireburn.ru/ + when: ["manual"] + + +build-x86_64-musl: + needs: ["test-rust-stable"] + stage: build + image: registry.gitlab.com/rust_musl_docker/image:stable-latest + cache: {} + variables: + RUSTFLAGS: -C target-feature=+crt-static + script: + - cargo build --release --target x86_64-unknown-linux-musl + artifacts: + expire_in: 30 days + paths: + - target/x86_64-unknown-linux-musl/release/kittybox_micropub + +.build-docker: + stage: build + cache: {} + image: + +.test: &test + stage: test + before_script: + - apt update + - apt install -y redis + script: + - cargo test --verbose + +test-rust-nightly: + needs: [] + image: rustlang/rust:nightly + cache: + <<: *global_cache + policy: pull + allow_failure: true + <<: *test + +test-rust-stable: + needs: [] + image: rust:latest + <<: *test + +rustfmt: + stage: lint + needs: [] + image: rust:latest + cache: + <<: *global_cache + policy: pull + before_script: + - rustup component add rustfmt + script: + - cargo fmt -- --check + allow_failure: true + interruptible: true + +clippy: + stage: lint + needs: [] + image: rust:latest + cache: + <<: *global_cache + policy: pull + before_script: + - rustup component add clippy + script: + - cargo clippy + allow_failure: true + interruptible: true diff --git a/.gitlab/.gitlab-webide.yml b/.gitlab/.gitlab-webide.yml new file mode 100644 index 0000000..7a8fe37 --- /dev/null +++ b/.gitlab/.gitlab-webide.yml @@ -0,0 +1,6 @@ +terminal: + # This can be any image that has the necessary runtime environment for your project. + image: rust:latest + script: sleep 60 + services: + - redis:latest diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs index 85360e8..4ab4ce0 100644 --- a/src/database/redis/mod.rs +++ b/src/database/redis/mod.rs @@ -310,4 +310,4 @@ pub mod tests { uri, child: redis_child, _tempdir: tempdir } } -} \ No newline at end of file +} -- cgit 1.4.1