2018-11-06 09:30:27 +00:00
|
|
|
|
image: tcitworld/mobilizon-ci
|
2018-01-13 22:35:11 +00:00
|
|
|
|
|
2018-12-18 11:26:10 +00:00
|
|
|
|
stages:
|
2020-12-22 23:01:25 +00:00
|
|
|
|
- install
|
2019-10-05 19:17:18 +00:00
|
|
|
|
- check
|
2021-01-14 14:47:35 +00:00
|
|
|
|
- build-js
|
2019-10-05 19:17:18 +00:00
|
|
|
|
- test
|
2023-11-20 17:37:35 +00:00
|
|
|
|
- build
|
2020-12-22 23:01:25 +00:00
|
|
|
|
- upload
|
2019-03-18 11:37:04 +00:00
|
|
|
|
- deploy
|
2018-01-13 22:35:11 +00:00
|
|
|
|
|
2018-01-13 22:40:06 +00:00
|
|
|
|
variables:
|
|
|
|
|
MIX_ENV: "test"
|
2019-01-03 10:33:52 +00:00
|
|
|
|
# DB Variables for Postgres / Postgis
|
2018-10-11 15:37:39 +00:00
|
|
|
|
POSTGRES_DB: mobilizon_test
|
2018-01-13 23:21:20 +00:00
|
|
|
|
POSTGRES_USER: postgres
|
2021-06-07 15:41:50 +00:00
|
|
|
|
POSTGRES_PASSWORD: postgres
|
2018-01-13 23:47:03 +00:00
|
|
|
|
POSTGRES_HOST: postgres
|
2019-01-03 10:33:52 +00:00
|
|
|
|
# DB Variables for Mobilizon
|
|
|
|
|
MOBILIZON_DATABASE_USERNAME: $POSTGRES_USER
|
|
|
|
|
MOBILIZON_DATABASE_PASSWORD: $POSTGRES_PASSWORD
|
|
|
|
|
MOBILIZON_DATABASE_DBNAME: $POSTGRES_DB
|
|
|
|
|
MOBILIZON_DATABASE_HOST: $POSTGRES_HOST
|
2018-12-18 10:24:22 +00:00
|
|
|
|
GEOLITE_CITIES_PATH: "/usr/share/GeoIP/GeoLite2-City.mmdb"
|
2019-10-05 17:07:50 +00:00
|
|
|
|
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true"
|
2020-12-21 15:56:38 +00:00
|
|
|
|
# Release elements
|
2020-12-22 23:01:25 +00:00
|
|
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
|
2021-01-13 08:05:39 +00:00
|
|
|
|
ARCH: "amd64"
|
2021-10-04 16:59:41 +00:00
|
|
|
|
EXPORT_FORMATS: "csv,ods,pdf"
|
2021-10-21 10:00:38 +00:00
|
|
|
|
APP_VERSION: "${CI_COMMIT_REF_NAME}"
|
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
2020-12-21 15:56:38 +00:00
|
|
|
|
|
2019-10-07 08:59:21 +00:00
|
|
|
|
cache:
|
2021-01-13 08:05:39 +00:00
|
|
|
|
key: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
|
2019-10-07 08:59:21 +00:00
|
|
|
|
paths:
|
|
|
|
|
- deps/
|
2020-12-22 23:01:25 +00:00
|
|
|
|
- _build/
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- node_modules
|
|
|
|
|
- .npm
|
2020-12-22 23:01:25 +00:00
|
|
|
|
|
|
|
|
|
# Installed dependencies are cached across the pipeline
|
|
|
|
|
# So there is no need to reinstall them all the time
|
|
|
|
|
# It saves minutes during a pipeline build time
|
|
|
|
|
install:
|
|
|
|
|
stage: install
|
|
|
|
|
script:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm ci
|
2021-01-12 18:47:10 +00:00
|
|
|
|
- mix deps.get
|
|
|
|
|
- mix compile
|
2019-10-07 08:59:21 +00:00
|
|
|
|
|
2021-01-11 12:58:40 +00:00
|
|
|
|
lint-elixir:
|
2019-10-05 19:17:18 +00:00
|
|
|
|
stage: check
|
2021-01-14 14:07:59 +00:00
|
|
|
|
before_script:
|
|
|
|
|
- mix deps.get
|
2019-03-22 10:37:58 +00:00
|
|
|
|
script:
|
2019-10-07 08:59:21 +00:00
|
|
|
|
- export EXITVALUE=0
|
2022-01-18 13:17:48 +00:00
|
|
|
|
- git fetch origin ${CI_DEFAULT_BRANCH}
|
|
|
|
|
- TARGET_SHA1=$(git show-ref -s ${CI_DEFAULT_BRANCH})
|
|
|
|
|
- echo "$TARGET_SHA1"
|
2019-10-07 08:59:21 +00:00
|
|
|
|
- mix format --check-formatted --dry-run || export EXITVALUE=1
|
2022-01-18 13:17:48 +00:00
|
|
|
|
- mix credo diff --from-git-merge-base $TARGET_SHA1 --strict -a || export EXITVALUE=1
|
2021-01-25 15:31:57 +00:00
|
|
|
|
- mix sobelow --config || export EXITVALUE=1
|
2021-01-11 12:58:40 +00:00
|
|
|
|
- exit $EXITVALUE
|
2023-03-17 18:16:15 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
reports:
|
|
|
|
|
codequality: codeclimate.json
|
|
|
|
|
|
2021-01-11 12:58:40 +00:00
|
|
|
|
lint-front:
|
2023-11-14 14:35:37 +00:00
|
|
|
|
image: node:20
|
2021-01-11 12:58:40 +00:00
|
|
|
|
stage: check
|
|
|
|
|
before_script:
|
|
|
|
|
- export EXITVALUE=0
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm ci
|
2021-01-11 12:58:40 +00:00
|
|
|
|
script:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm run lint || export EXITVALUE=1
|
2023-11-15 11:29:39 +00:00
|
|
|
|
- npx prettier -c . || export EXITVALUE=1
|
2019-10-07 08:59:21 +00:00
|
|
|
|
- exit $EXITVALUE
|
2020-12-22 23:01:25 +00:00
|
|
|
|
|
|
|
|
|
build-frontend:
|
2021-01-14 14:47:35 +00:00
|
|
|
|
stage: build-js
|
2023-11-14 14:35:37 +00:00
|
|
|
|
image: node:20
|
2020-12-22 23:01:25 +00:00
|
|
|
|
before_script:
|
2021-01-12 18:47:10 +00:00
|
|
|
|
- apt update
|
2023-11-15 13:53:30 +00:00
|
|
|
|
- apt install -y --no-install-recommends python3 build-essential webp imagemagick gifsicle jpegoptim optipng pngquant
|
2020-12-22 23:01:25 +00:00
|
|
|
|
script:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm install --frozen-lockfile
|
|
|
|
|
- npm run build
|
2019-10-07 08:59:21 +00:00
|
|
|
|
artifacts:
|
2020-12-22 23:01:25 +00:00
|
|
|
|
expire_in: 5 days
|
2019-03-22 10:04:57 +00:00
|
|
|
|
paths:
|
2021-01-12 18:47:10 +00:00
|
|
|
|
- priv/static
|
2020-12-22 23:01:25 +00:00
|
|
|
|
needs:
|
2021-01-12 18:47:10 +00:00
|
|
|
|
- lint-front
|
2019-03-22 10:04:57 +00:00
|
|
|
|
|
2019-10-05 19:17:18 +00:00
|
|
|
|
deps:
|
|
|
|
|
stage: check
|
2021-01-14 14:07:59 +00:00
|
|
|
|
before_script:
|
|
|
|
|
- mix deps.get
|
2018-12-18 11:26:10 +00:00
|
|
|
|
script:
|
2019-10-07 08:59:21 +00:00
|
|
|
|
- export EXITVALUE=0
|
|
|
|
|
- mix hex.outdated || export EXITVALUE=1
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm outdated || export EXITVALUE=1
|
2019-10-07 08:59:21 +00:00
|
|
|
|
- exit $EXITVALUE
|
2019-03-08 12:42:34 +00:00
|
|
|
|
allow_failure: true
|
2020-12-22 23:01:25 +00:00
|
|
|
|
needs:
|
|
|
|
|
- install
|
2018-01-13 22:35:11 +00:00
|
|
|
|
|
2021-06-07 15:21:41 +00:00
|
|
|
|
exunit:
|
|
|
|
|
stage: test
|
|
|
|
|
services:
|
2023-11-20 17:37:35 +00:00
|
|
|
|
- name: postgis/postgis:16-3.4
|
2021-06-07 15:21:41 +00:00
|
|
|
|
alias: postgres
|
|
|
|
|
variables:
|
|
|
|
|
MIX_ENV: test
|
|
|
|
|
before_script:
|
2023-09-01 10:14:36 +00:00
|
|
|
|
- mix deps.get
|
|
|
|
|
- mix compile
|
|
|
|
|
- mix tz_world.update
|
2021-06-07 15:21:41 +00:00
|
|
|
|
- mix ecto.create
|
2020-12-22 23:01:25 +00:00
|
|
|
|
- mix ecto.migrate
|
2018-01-13 22:35:11 +00:00
|
|
|
|
script:
|
2018-12-18 11:26:10 +00:00
|
|
|
|
- mix coveralls
|
2021-01-12 19:09:44 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
when: always
|
|
|
|
|
reports:
|
|
|
|
|
junit:
|
|
|
|
|
- test-junit-report.xml
|
|
|
|
|
expire_in: 30 days
|
2020-12-02 10:19:39 +00:00
|
|
|
|
|
2022-09-21 06:32:42 +00:00
|
|
|
|
vitest:
|
2020-12-02 10:19:39 +00:00
|
|
|
|
stage: test
|
2020-12-22 23:01:25 +00:00
|
|
|
|
needs:
|
2021-01-11 12:58:40 +00:00
|
|
|
|
- lint-front
|
2021-01-14 14:07:59 +00:00
|
|
|
|
before_script:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm install --frozen-lockfile
|
2020-12-02 10:19:39 +00:00
|
|
|
|
script:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm run coverage --reporter=default --reporter=junit --outputFile.junit=./junit.xml
|
2020-12-02 10:19:39 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
when: always
|
|
|
|
|
paths:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- coverage
|
2020-12-22 23:01:25 +00:00
|
|
|
|
reports:
|
|
|
|
|
junit:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- junit.xml
|
2020-12-02 10:19:39 +00:00
|
|
|
|
expire_in: 30 days
|
2020-12-22 23:01:25 +00:00
|
|
|
|
|
2022-09-27 08:50:14 +00:00
|
|
|
|
e2e:
|
|
|
|
|
stage: test
|
2024-11-29 17:26:51 +00:00
|
|
|
|
except:
|
|
|
|
|
- tags@framasoft/mobilizon
|
2022-09-27 08:50:14 +00:00
|
|
|
|
services:
|
2023-11-20 17:37:35 +00:00
|
|
|
|
- name: postgis/postgis:16-3.4
|
2022-09-27 08:50:14 +00:00
|
|
|
|
alias: postgres
|
|
|
|
|
variables:
|
|
|
|
|
MIX_ENV: "e2e"
|
|
|
|
|
before_script:
|
|
|
|
|
- mix deps.get
|
|
|
|
|
- mix ecto.create
|
|
|
|
|
- mix ecto.migrate
|
|
|
|
|
- mix run priv/repo/e2e.seed.exs
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- npm install && npm run build && npx playwright install
|
2022-09-27 08:50:14 +00:00
|
|
|
|
- mix phx.digest
|
|
|
|
|
script:
|
|
|
|
|
- mix phx.server &
|
|
|
|
|
- npx wait-on http://localhost:4000
|
|
|
|
|
- npx playwright test --project $BROWSER
|
|
|
|
|
parallel:
|
|
|
|
|
matrix:
|
2023-11-15 13:46:09 +00:00
|
|
|
|
- BROWSER: ["firefox", "chromium"]
|
2022-09-27 08:50:14 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
expire_in: 2 days
|
|
|
|
|
paths:
|
2023-11-14 16:24:42 +00:00
|
|
|
|
- playwright-report/
|
|
|
|
|
- test-results/
|
2019-10-05 19:17:18 +00:00
|
|
|
|
|
2021-01-14 14:47:12 +00:00
|
|
|
|
pages:
|
|
|
|
|
stage: deploy
|
|
|
|
|
script:
|
2023-11-20 17:57:07 +00:00
|
|
|
|
- mv public public-mbz
|
2021-01-14 14:47:12 +00:00
|
|
|
|
- mkdir public
|
2021-03-09 09:06:54 +00:00
|
|
|
|
- mix deps.get
|
2021-01-14 14:47:12 +00:00
|
|
|
|
- mix docs
|
|
|
|
|
- mv doc public/backend
|
2023-11-14 16:24:42 +00:00
|
|
|
|
# #- npm run styleguide:build
|
|
|
|
|
# #- mv styleguide public/frontend
|
2021-01-14 16:01:44 +00:00
|
|
|
|
rules:
|
2021-11-09 08:12:04 +00:00
|
|
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
2021-01-14 16:01:44 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
expire_in: 1 hour
|
|
|
|
|
paths:
|
|
|
|
|
- public
|
2020-11-09 09:04:55 +00:00
|
|
|
|
|
|
|
|
|
.docker: &docker
|
2023-11-20 17:37:35 +00:00
|
|
|
|
stage: build
|
2023-08-18 14:22:19 +00:00
|
|
|
|
image: docker:24
|
2021-10-21 10:00:38 +00:00
|
|
|
|
variables:
|
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
|
DOCKER_HOST: tcp://docker:2376
|
|
|
|
|
DOCKER_TLS_VERIFY: 1
|
|
|
|
|
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
|
|
|
|
DOCKER_DRIVER: overlay2
|
2023-11-20 17:37:35 +00:00
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
2021-10-21 10:00:38 +00:00
|
|
|
|
services:
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- docker:24-dind
|
2020-11-09 09:04:55 +00:00
|
|
|
|
cache: {}
|
2021-11-29 09:38:05 +00:00
|
|
|
|
before_script:
|
|
|
|
|
# Install buildx
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- wget https://github.com/docker/buildx/releases/download/v0.11.2/buildx-v0.11.2.linux-amd64
|
2021-11-29 09:38:05 +00:00
|
|
|
|
- mkdir -p ~/.docker/cli-plugins/
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- mv buildx-v0.11.2.linux-amd64 ~/.docker/cli-plugins/docker-buildx
|
2021-11-29 09:38:05 +00:00
|
|
|
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
|
|
|
|
# Create env
|
|
|
|
|
- docker context create tls-environment
|
|
|
|
|
- docker buildx create --use tls-environment
|
|
|
|
|
# Install qemu/binfmt
|
|
|
|
|
- docker pull tonistiigi/binfmt:latest
|
|
|
|
|
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
|
2023-11-20 17:37:35 +00:00
|
|
|
|
# Install jq
|
|
|
|
|
- apk --no-cache add jq
|
2021-11-29 09:38:05 +00:00
|
|
|
|
# Login to DockerHub
|
|
|
|
|
- mkdir -p ~/.docker
|
|
|
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json
|
2021-11-25 16:50:57 +00:00
|
|
|
|
tags:
|
|
|
|
|
- "privileged"
|
|
|
|
|
|
|
|
|
|
build-docker-main:
|
|
|
|
|
<<: *docker
|
|
|
|
|
rules:
|
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
2022-10-12 08:24:21 +00:00
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_TRIGGERED == "true"'
|
2021-11-25 16:50:57 +00:00
|
|
|
|
script:
|
2023-11-20 17:37:35 +00:00
|
|
|
|
- docker buildx build --platform linux/amd64 -t framasoft/mobilizon:main -f docker/production/Dockerfile .
|
2021-11-25 16:50:57 +00:00
|
|
|
|
|
2023-11-20 17:37:35 +00:00
|
|
|
|
build-docker-tag:
|
2021-11-25 16:50:57 +00:00
|
|
|
|
<<: *docker
|
2022-11-21 11:00:08 +00:00
|
|
|
|
rules: &release-tag-rules
|
2021-11-25 16:50:57 +00:00
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
2023-11-30 09:00:05 +00:00
|
|
|
|
- if: $CI_COMMIT_TAG != null
|
2022-10-12 15:08:34 +00:00
|
|
|
|
when: on_success
|
2021-11-25 16:50:57 +00:00
|
|
|
|
timeout: 3 hours
|
2020-11-09 09:04:55 +00:00
|
|
|
|
script:
|
2021-10-21 10:00:38 +00:00
|
|
|
|
- >
|
|
|
|
|
docker buildx build
|
|
|
|
|
--push
|
2023-08-18 14:22:19 +00:00
|
|
|
|
--platform linux/${ARCH}
|
2023-11-20 17:37:35 +00:00
|
|
|
|
--provenance=false
|
2023-08-18 14:22:19 +00:00
|
|
|
|
--build-arg="${ERL_FLAGS}"
|
2023-11-20 17:37:35 +00:00
|
|
|
|
-t framasoft/mobilizon:${CI_COMMIT_TAG}-${ARCH}
|
2023-05-23 16:10:40 +00:00
|
|
|
|
-f docker/production/Dockerfile .
|
2023-08-18 14:22:19 +00:00
|
|
|
|
parallel:
|
|
|
|
|
matrix:
|
|
|
|
|
- ARCH: ["amd64"]
|
|
|
|
|
ERL_FLAGS: ["ERL_FLAGS="]
|
|
|
|
|
- ARCH: ["arm64"]
|
|
|
|
|
ERL_FLAGS: ["ERL_FLAGS=+JMsingle true"]
|
2023-05-23 16:10:40 +00:00
|
|
|
|
|
2023-11-20 17:37:35 +00:00
|
|
|
|
# Create manifest and push
|
|
|
|
|
docker-manifest-push:
|
|
|
|
|
<<: *docker
|
|
|
|
|
needs: ["build-docker-tag"]
|
|
|
|
|
rules: &release-tag-rules
|
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
|
|
|
|
- if: $CI_COMMIT_TAG != null
|
|
|
|
|
when: on_success
|
|
|
|
|
script:
|
|
|
|
|
- >
|
|
|
|
|
docker manifest create framasoft/mobilizon:${CI_COMMIT_TAG}
|
|
|
|
|
--amend framasoft/mobilizon:${CI_COMMIT_TAG}-amd64
|
|
|
|
|
--amend framasoft/mobilizon:${CI_COMMIT_TAG}-arm64
|
|
|
|
|
- docker manifest push --purge framasoft/mobilizon:${CI_COMMIT_TAG}
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
# Simply creating an alias to the tag doesn't work:
|
|
|
|
|
# « xxx is a manifest list »
|
|
|
|
|
# https://joonas.fi/2021/02/docker-multi-arch-image-tooling-buildx/
|
|
|
|
|
###
|
|
|
|
|
docker-latest:
|
|
|
|
|
<<: *docker
|
|
|
|
|
needs: ["docker-manifest-push"]
|
|
|
|
|
rules: &release-tag-rules
|
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
|
|
|
|
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG !~ /alpha|beta|rc/
|
|
|
|
|
when: on_success
|
|
|
|
|
script:
|
|
|
|
|
- echo docker manifest create framasoft/mobilizon:latest $(docker manifest inspect framasoft/mobilizon:$CI_COMMIT_TAG | jq '.manifests[] | .digest' | xargs -I {} echo framasoft/mobilizon@{})
|
|
|
|
|
- docker manifest create framasoft/mobilizon:latest $(docker manifest inspect framasoft/mobilizon:$CI_COMMIT_TAG | jq -r '.manifests[] | .digest' | xargs -I {} echo framasoft/mobilizon@{})
|
|
|
|
|
- docker manifest push --purge framasoft/mobilizon:latest
|
|
|
|
|
|
2021-10-21 10:00:38 +00:00
|
|
|
|
# Packaging app for amd64
|
2020-12-22 23:01:25 +00:00
|
|
|
|
package-app:
|
2024-04-10 12:36:21 +00:00
|
|
|
|
image: mobilizon/buildpack:1.16.1-erlang-26.2.2-${SYSTEM}
|
2023-11-20 17:37:35 +00:00
|
|
|
|
stage: build
|
2021-02-10 13:11:20 +00:00
|
|
|
|
variables: &release-variables
|
2020-12-21 15:56:38 +00:00
|
|
|
|
MIX_ENV: "prod"
|
2022-04-08 08:40:35 +00:00
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
|
TZ: Etc/UTC
|
2022-05-06 10:41:34 +00:00
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
2021-02-10 13:11:20 +00:00
|
|
|
|
script: &release-script
|
2021-01-12 18:47:10 +00:00
|
|
|
|
- mix local.hex --force
|
|
|
|
|
- mix local.rebar --force
|
2021-11-10 15:37:24 +00:00
|
|
|
|
- mix deps.get --only-prod
|
|
|
|
|
- mix compile
|
2022-10-17 06:37:22 +00:00
|
|
|
|
- mix phx.digest.clean --all && mix phx.digest
|
2021-03-16 10:07:44 +00:00
|
|
|
|
- mix release --path release/mobilizon
|
2021-10-18 12:46:04 +00:00
|
|
|
|
- cd release/mobilizon && ln -s lib/mobilizon-*/priv priv && cd ../../
|
2021-10-18 12:16:48 +00:00
|
|
|
|
- du -sh release/
|
2021-10-18 12:46:04 +00:00
|
|
|
|
- 'echo "Artifact: ${APP_ASSET}"'
|
|
|
|
|
- tar czf ${APP_ASSET} -C release mobilizon
|
|
|
|
|
- du -sh ${APP_ASSET}
|
2021-02-10 13:11:20 +00:00
|
|
|
|
only:
|
|
|
|
|
- tags@framasoft/mobilizon
|
|
|
|
|
artifacts:
|
2021-12-13 16:59:54 +00:00
|
|
|
|
expire_in: 2 days
|
2021-02-10 13:11:20 +00:00
|
|
|
|
paths:
|
2021-10-18 14:05:45 +00:00
|
|
|
|
- ${APP_ASSET}
|
2023-11-20 17:37:35 +00:00
|
|
|
|
parallel:
|
|
|
|
|
matrix:
|
|
|
|
|
- SYSTEM:
|
|
|
|
|
[
|
|
|
|
|
"debian-bookworm",
|
|
|
|
|
"debian-bullseye",
|
2023-12-07 11:30:27 +00:00
|
|
|
|
"debian-buster",
|
2023-11-20 17:37:35 +00:00
|
|
|
|
"ubuntu-jammy",
|
|
|
|
|
"ubuntu-focal",
|
|
|
|
|
"fedora-38",
|
|
|
|
|
"fedora-39",
|
|
|
|
|
]
|
2021-02-10 13:11:20 +00:00
|
|
|
|
|
|
|
|
|
package-app-dev:
|
2023-11-20 17:37:35 +00:00
|
|
|
|
stage: build
|
2021-02-10 13:11:20 +00:00
|
|
|
|
variables: *release-variables
|
|
|
|
|
script: *release-script
|
|
|
|
|
except:
|
|
|
|
|
- tags@framasoft/mobilizon
|
2020-12-21 15:56:38 +00:00
|
|
|
|
artifacts:
|
2020-12-22 23:01:25 +00:00
|
|
|
|
expire_in: 2 days
|
2020-12-21 15:56:38 +00:00
|
|
|
|
paths:
|
2021-10-18 14:05:45 +00:00
|
|
|
|
- ${APP_ASSET}
|
2020-12-21 15:56:38 +00:00
|
|
|
|
|
2021-10-21 10:00:38 +00:00
|
|
|
|
# Packaging app for multi-arch
|
2023-11-23 12:56:58 +00:00
|
|
|
|
package-multi-arch-release:
|
2023-11-20 17:37:35 +00:00
|
|
|
|
stage: build
|
2023-08-18 14:22:19 +00:00
|
|
|
|
image: docker:24
|
2021-10-21 10:00:38 +00:00
|
|
|
|
variables:
|
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
|
DOCKER_HOST: tcp://docker:2376
|
|
|
|
|
DOCKER_TLS_VERIFY: 1
|
|
|
|
|
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
|
|
|
|
DOCKER_DRIVER: overlay2
|
2022-05-06 10:41:34 +00:00
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
|
|
|
|
OS: debian-buster
|
2021-10-21 10:00:38 +00:00
|
|
|
|
services:
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- docker:24-dind
|
2021-10-21 10:00:38 +00:00
|
|
|
|
cache: {}
|
|
|
|
|
before_script:
|
|
|
|
|
# Install buildx
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- wget https://github.com/docker/buildx/releases/download/v0.11.2/buildx-v0.11.2.linux-amd64
|
2021-10-21 10:00:38 +00:00
|
|
|
|
- mkdir -p ~/.docker/cli-plugins/
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- mv buildx-v0.11.2.linux-amd64 ~/.docker/cli-plugins/docker-buildx
|
2021-10-21 10:00:38 +00:00
|
|
|
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
|
|
|
|
# Create env
|
|
|
|
|
- docker context create tls-environment
|
|
|
|
|
- docker buildx create --use tls-environment
|
|
|
|
|
# Install qemu/binfmt
|
|
|
|
|
- docker pull tonistiigi/binfmt:latest
|
|
|
|
|
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
|
|
|
|
|
script:
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- docker buildx build --platform linux/${ARCH} --output type=local,dest=releases --build-arg="ERL_FLAGS=+JMsingle true" --build-arg APP_ASSET=${APP_ASSET} -f docker/multiarch/Dockerfile .
|
2021-10-21 10:00:38 +00:00
|
|
|
|
- ls -alh releases/mobilizon/
|
|
|
|
|
- du -sh releases/mobilizon/${APP_ASSET}
|
2021-11-15 12:37:00 +00:00
|
|
|
|
- mv releases/mobilizon/${APP_ASSET} .
|
2021-10-21 10:00:38 +00:00
|
|
|
|
tags:
|
|
|
|
|
- "privileged"
|
|
|
|
|
artifacts:
|
2021-12-13 16:59:54 +00:00
|
|
|
|
expire_in: 2 days
|
2021-10-21 10:00:38 +00:00
|
|
|
|
paths:
|
2021-11-15 12:37:00 +00:00
|
|
|
|
- ${APP_ASSET}
|
2022-11-06 19:21:26 +00:00
|
|
|
|
- erl_crash.dump # if there's a memory issue
|
2021-10-21 10:00:38 +00:00
|
|
|
|
parallel:
|
|
|
|
|
matrix:
|
2023-08-18 14:22:19 +00:00
|
|
|
|
- ARCH: ["arm64"]
|
2023-11-20 17:37:35 +00:00
|
|
|
|
## Currently not used as the hexpm base images do not have support for other architectures than amd64
|
|
|
|
|
# SYSTEM:
|
|
|
|
|
# [
|
|
|
|
|
# "debian-bookworm",
|
|
|
|
|
# "debian-bullseye",
|
|
|
|
|
# "ubuntu-jammy",
|
|
|
|
|
# "ubuntu-focal",
|
|
|
|
|
# "ubuntu-bionic",
|
|
|
|
|
# "alpine-3.17.5",
|
|
|
|
|
# "alpine-3.18.4",
|
|
|
|
|
# "fedora-38",
|
|
|
|
|
# "fedora-39",
|
|
|
|
|
# ]
|
2021-10-21 10:00:38 +00:00
|
|
|
|
rules:
|
2022-11-06 19:21:26 +00:00
|
|
|
|
- if: '$CI_COMMIT_TAG != null || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_TRIGGERED == "true"'
|
2021-11-10 15:38:42 +00:00
|
|
|
|
timeout: 3h
|
2022-10-11 11:57:04 +00:00
|
|
|
|
allow_failure: true
|
2021-10-21 10:00:38 +00:00
|
|
|
|
|
|
|
|
|
# Release
|
2020-12-22 23:01:25 +00:00
|
|
|
|
release-upload:
|
|
|
|
|
stage: upload
|
2021-12-16 15:49:37 +00:00
|
|
|
|
image: framasoft/upload-packages:latest
|
2021-11-10 15:38:42 +00:00
|
|
|
|
variables:
|
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
2022-11-21 11:00:08 +00:00
|
|
|
|
rules:
|
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
2021-06-21 08:15:05 +00:00
|
|
|
|
script:
|
|
|
|
|
- eval `ssh-agent -s`
|
|
|
|
|
- ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i)
|
2021-11-10 15:38:42 +00:00
|
|
|
|
- echo "put -r ${APP_ASSET}" | sftp -o "VerifyHostKeyDNS yes" ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:public/
|
2020-12-21 15:56:38 +00:00
|
|
|
|
artifacts:
|
|
|
|
|
expire_in: 1 day
|
|
|
|
|
when: on_success
|
|
|
|
|
paths:
|
2021-01-13 08:05:39 +00:00
|
|
|
|
- mobilizon_*.tar.gz
|
2021-11-10 15:38:42 +00:00
|
|
|
|
parallel:
|
|
|
|
|
matrix:
|
|
|
|
|
- ARCH: ["amd64", "arm", "arm64"]
|
2022-10-11 11:57:04 +00:00
|
|
|
|
allow_failure: true
|
2021-01-27 10:43:12 +00:00
|
|
|
|
|
2021-06-21 08:15:05 +00:00
|
|
|
|
release-create:
|
|
|
|
|
stage: deploy
|
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
2022-11-21 11:00:08 +00:00
|
|
|
|
rules:
|
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
|
when: never
|
2021-11-12 16:20:27 +00:00
|
|
|
|
variables:
|
|
|
|
|
APP_ASSET_AMD64: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_amd64.tar.gz"
|
|
|
|
|
APP_ASSET_ARM: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_arm.tar.gz"
|
|
|
|
|
APP_ASSET_ARM64: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_arm64.tar.gz"
|
2021-06-21 08:15:05 +00:00
|
|
|
|
before_script:
|
2021-06-21 11:32:54 +00:00
|
|
|
|
- apk --no-cache add gawk sed grep
|
2021-06-21 08:15:05 +00:00
|
|
|
|
script: |
|
|
|
|
|
CHANGELOG=$(awk -v version="$APP_VERSION" '/^## / { printit = $2 == version }; printit' CHANGELOG.md | grep -v "## $APP_VERSION" | sed '1{/^$/d}')
|
|
|
|
|
ENDPOINT="https://packages.joinmobilizon.org"
|
|
|
|
|
|
2021-06-27 14:21:19 +00:00
|
|
|
|
release-cli create --name "$CI_COMMIT_TAG" \
|
2021-06-21 08:15:05 +00:00
|
|
|
|
--description "$CHANGELOG" \
|
|
|
|
|
--tag-name "$CI_COMMIT_TAG" \
|
2022-11-21 10:57:44 +00:00
|
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_AMD64}\",\"url\":\"${ENDPOINT}/${CI_COMMIT_REF_NAME}/${APP_ASSET_AMD64}\"}" \
|
|
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_ARM}\",\"url\":\"${ENDPOINT}/${CI_COMMIT_REF_NAME}/${APP_ASSET_ARM}\"}" \
|
|
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_ARM64}\",\"url\":\"${ENDPOINT}/${CI_COMMIT_REF_NAME}/${APP_ASSET_ARM64}\"}"
|