]> Untitled Git - lemmy.git/blob - .drone.yml
Adding 0.9.6 release notes.
[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.47.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.47.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
27   - name: cargo test
28     image: ekidd/rust-musl-builder:1.47.0
29     environment:
30       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
31       RUST_BACKTRACE: 1
32       RUST_TEST_THREADS: 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.47.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.47-slim-buster
107     environment:
108       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
109       RUST_BACKTRACE: 1
110       RUST_TEST_THREADS: 1
111     commands:
112       - apt-get update
113       - apt-get -y install --no-install-recommends espeak postgresql-client libssl-dev pkg-config libpq-dev
114       - cargo test --workspace --no-fail-fast
115       - cargo build
116
117   # Using Debian here because there seems to be no official Alpine-based Rust docker image for ARM.
118   - name: cargo build
119     image: rust:1.47-slim-buster
120     commands:
121       - apt-get update
122       - apt-get -y install --no-install-recommends libssl-dev pkg-config libpq-dev
123       - cargo build
124       - mv target/debug/lemmy_server target/lemmy_server
125
126   - name: run federation tests
127     image: node:15-buster-slim
128     environment:
129       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
130       DO_WRITE_HOSTS_FILE: 1
131     commands:
132       - mkdir -p /usr/share/man/man1 /usr/share/man/man7
133       - apt-get update
134       - apt-get -y install --no-install-recommends bash curl libssl-dev pkg-config libpq-dev postgresql-client libc6-dev
135       - bash api_tests/prepare-drone-federation-test.sh
136       - cd api_tests/
137       - yarn
138       - yarn api-test
139
140   - name: make release build and push to docker hub
141     image: plugins/docker
142     settings:
143       dockerfile: docker/prod/Dockerfile.arm
144       username:
145         from_secret: docker_username
146       password:
147         from_secret: docker_password
148       repo: dessalines/lemmy
149       auto_tag: true
150       auto_tag_suffix: linux-arm64
151     when:
152       ref:
153         - refs/tags/*
154
155   - name: push to docker manifest
156     image: plugins/manifest
157     settings: 
158       username:
159         from_secret: docker_username
160       password:
161         from_secret: docker_password
162       target: "dessalines/lemmy:${DRONE_TAG}"
163       template: "dessalines/lemmy:${DRONE_TAG}-OS-ARCH"
164       platforms:
165         - linux/amd64
166         - linux/arm64
167       ignore_missing: true
168     when:
169       ref:
170       - refs/tags/*
171
172 services:
173   - name: database
174     image: postgres:12-alpine
175     environment:
176       POSTGRES_USER: lemmy
177       POSTGRES_PASSWORD: password