diff options
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 99 |
1 files changed, 99 insertions, 0 deletions
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 |