2022-01-23 00:00:11 -05:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2022-11-26 23:26:53 -05:00
|
|
|
name: memex
|
2022-01-23 00:00:11 -05:00
|
|
|
|
|
|
|
steps:
|
2022-02-25 22:19:06 -05:00
|
|
|
- name: restore-cache
|
|
|
|
image: drillster/drone-volume-cache
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
restore: true
|
|
|
|
mount:
|
|
|
|
- _build
|
|
|
|
- deps
|
2023-02-05 10:38:57 -05:00
|
|
|
- .npm
|
|
|
|
- .mix
|
2022-02-25 22:19:06 -05:00
|
|
|
|
2022-01-23 00:00:11 -05:00
|
|
|
- name: test
|
2023-10-20 18:23:25 -04:00
|
|
|
image: elixir:1.15.7-alpine
|
2022-01-23 00:00:11 -05:00
|
|
|
environment:
|
2022-07-25 19:31:54 -04:00
|
|
|
TEST_DATABASE_URL: ecto://postgres:postgres@database/memex_test
|
2022-02-25 22:19:06 -05:00
|
|
|
HOST: testing.example.tld
|
2023-02-05 10:38:57 -05:00
|
|
|
MIX_HOME: /drone/src/.mix
|
|
|
|
MIX_ARCHIVES: /drone/src/.mix/archives
|
|
|
|
MIX_ENV: test
|
2022-01-23 00:00:11 -05:00
|
|
|
commands:
|
2023-02-05 10:38:57 -05:00
|
|
|
- apk add --no-cache build-base npm git
|
|
|
|
- mix local.rebar --force --if-missing
|
|
|
|
- mix local.hex --force --if-missing
|
2022-01-23 00:00:11 -05:00
|
|
|
- mix deps.get
|
2023-02-05 10:38:57 -05:00
|
|
|
- npm set cache .npm
|
|
|
|
- npm --prefix ./assets ci --no-audit --prefer-offline
|
2022-07-30 16:24:21 -04:00
|
|
|
- npm run --prefix ./assets deploy
|
|
|
|
- mix do phx.digest, gettext.extract
|
2022-11-26 23:26:53 -05:00
|
|
|
- mix test.all
|
2022-01-23 00:00:11 -05:00
|
|
|
|
2022-02-25 22:19:06 -05:00
|
|
|
- name: build and publish stable
|
2022-07-30 16:24:21 -04:00
|
|
|
image: thegeeklab/drone-docker-buildx
|
|
|
|
privileged: true
|
2022-02-12 02:38:15 -05:00
|
|
|
settings:
|
2022-07-25 19:31:54 -04:00
|
|
|
repo: shibaobun/memex
|
2022-07-30 16:24:21 -04:00
|
|
|
purge: true
|
|
|
|
compress: true
|
2023-04-16 17:05:13 -04:00
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
2022-02-25 22:19:06 -05:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
2022-02-12 02:38:15 -05:00
|
|
|
tags: latest
|
2022-02-25 22:19:06 -05:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- stable
|
|
|
|
|
|
|
|
- name: build and publish tagged version
|
2022-07-30 16:24:21 -04:00
|
|
|
image: thegeeklab/drone-docker-buildx
|
|
|
|
privileged: true
|
2022-02-25 22:19:06 -05:00
|
|
|
settings:
|
2022-07-25 19:31:54 -04:00
|
|
|
repo: shibaobun/memex
|
2022-07-30 16:24:21 -04:00
|
|
|
purge: true
|
|
|
|
compress: true
|
2023-04-16 17:05:13 -04:00
|
|
|
platforms:
|
|
|
|
- linux/amd64
|
2022-02-12 02:38:15 -05:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
2022-02-25 22:19:06 -05:00
|
|
|
tags:
|
|
|
|
- ${DRONE_TAG}
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- tag
|
|
|
|
|
|
|
|
- name: rebuild-cache
|
|
|
|
image: drillster/drone-volume-cache
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
rebuild: true
|
|
|
|
mount:
|
|
|
|
- _build
|
|
|
|
- deps
|
2023-02-05 10:38:57 -05:00
|
|
|
- .npm
|
|
|
|
- .mix
|
2022-02-12 02:38:15 -05:00
|
|
|
|
2022-01-23 00:00:11 -05:00
|
|
|
services:
|
|
|
|
- name: database
|
|
|
|
image: postgres:13
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: postgres
|
2022-02-25 22:19:06 -05:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
host:
|
2022-07-30 16:24:21 -04:00
|
|
|
path: /run/media/default/ssdsrv/gitea/drone-cache
|
2022-02-25 22:19:06 -05:00
|
|
|
- name: docker_sock
|
|
|
|
host:
|
|
|
|
path: /var/run/docker.sock
|