about summary refs log tree commit diff
path: root/.gitlab-ci.yml
blob: 892325b22e59fc45c85f5faa1223d0018eb25e6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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