]> Untitled Git - lemmy.git/blob - .drone.yml
Forbid usage of unwrap
[lemmy.git] / .drone.yml
1 ---
2 kind: pipeline
3 name: amd64
4
5 platform:
6   os: linux
7   arch: amd64
8
9 steps:
10
11   - name: chown repo
12     image: ekidd/rust-musl-builder:1.50.0
13     user: root
14     commands:
15       - chown 1000:1000 . -R
16
17   - name: check formatting
18     image: rustdocker/rust:nightly
19     commands:
20       - /root/.cargo/bin/cargo fmt -- --check
21
22   - name: cargo clippy
23     image: ekidd/rust-musl-builder:1.50.0
24     commands:
25       - cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
26       - cargo clippy --workspace -- -D clippy::unwrap_used
27
28   - name: cargo test
29     image: ekidd/rust-musl-builder:1.50.0
30     environment:
31       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
32       RUST_BACKTRACE: 1
33     commands:
34       - sudo apt-get update
35       - sudo apt-get -y install --no-install-recommends espeak postgresql-client
36       - cargo test --workspace --no-fail-fast
37
38   - name: cargo build
39     image: ekidd/rust-musl-builder:1.50.0
40     commands:
41       - cargo build
42       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
43
44   - name: run federation tests
45     image: node:15-alpine3.12
46     environment:
47       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
48       DO_WRITE_HOSTS_FILE: 1
49     commands:
50       - apk add bash curl postgresql-client
51       - bash api_tests/prepare-drone-federation-test.sh
52       - cd api_tests/
53       - yarn
54       - yarn api-test
55
56   - name: make release build and push to docker hub
57     image: plugins/docker
58     settings:
59       dockerfile: docker/prod/Dockerfile
60       username:
61         from_secret: docker_username
62       password:
63         from_secret: docker_password
64       repo: dessalines/lemmy
65       auto_tag: true
66       auto_tag_suffix: linux-amd64
67     when:
68       ref:
69       - refs/tags/*
70
71   - name: push to docker manifest
72     image: plugins/manifest
73     settings: 
74       username:
75         from_secret: docker_username
76       password:
77         from_secret: docker_password
78       target: "dessalines/lemmy:${DRONE_TAG}"
79       template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
80       platforms:
81         - linux/amd64
82         - linux/arm64
83       ignore_missing: true
84     when:
85       ref:
86       - refs/tags/*
87
88 services:
89   - name: database
90     image: postgres:12-alpine
91     environment:
92       POSTGRES_USER: lemmy
93       POSTGRES_PASSWORD: password
94
95 ---
96 kind: pipeline
97 name: arm64
98
99 platform:
100   os: linux
101   arch: arm64
102
103 steps:
104
105   - name: cargo test
106     image: rust:1.50-slim-buster
107     environment:
108       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
109       RUST_BACKTRACE: 1
110     commands:
111       - apt-get update
112       - apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
113       - cargo test --workspace --no-fail-fast
114       - cargo build
115
116   # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
117   - name: cargo build
118     image: rust:1.50-slim-buster
119     commands:
120       - apt-get update
121       - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
122       - cargo build
123       - mv target/debug/lemmy_server target/lemmy_server
124
125   - name: run federation tests
126     image: node:15-buster-slim
127     environment:
128       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
129       DO_WRITE_HOSTS_FILE: 1
130     commands:
131       - mkdir -p /usr/share/man/man1 /usr/share/man/man7
132       - apt-get update
133       - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
134       - bash api_tests/prepare-drone-federation-test.sh
135       - cd api_tests/
136       - yarn
137       - yarn api-test
138
139   - name: make release build and push to docker hub
140     image: plugins/docker
141     settings:
142       dockerfile: docker/prod/Dockerfile.arm
143       username:
144         from_secret: docker_username
145       password:
146         from_secret: docker_password
147       repo: dessalines/lemmy
148       auto_tag: true
149       auto_tag_suffix: linux-arm64
150     when:
151       ref:
152         - refs/tags/*
153
154   - name: push to docker manifest
155     image: plugins/manifest
156     settings: 
157       username:
158         from_secret: docker_username
159       password:
160         from_secret: docker_password
161       target: "dessalines/lemmy:${DRONE_TAG}"
162       template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
163       platforms:
164         - linux/amd64
165         - linux/arm64
166       ignore_missing: true
167     when:
168       ref:
169       - refs/tags/*
170
171 services:
172   - name: database
173     image: postgres:12-alpine
174     environment:
175       POSTGRES_USER: lemmy
176       POSTGRES_PASSWORD: password