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