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