X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=.gitlab-ci.yml;h=bebd97efbcb65a21382b092f7c7c6029f302c1bb;hb=3ad3a114de800ac406373693e9ae6a9bdb8b7fca;hp=9a754ed782563e32b897af74935f9b6c0c5dd770;hpb=cf99b1c1fd89553f072cc5a466aaebbe59d3e618;p=akkoma diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a754ed78..bebd97efb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: elixir:1.9.4 +image: git.pleroma.social:5050/pleroma/pleroma/ci-base variables: &global_variables POSTGRES_DB: pleroma_test @@ -8,7 +8,9 @@ variables: &global_variables MIX_ENV: test cache: &global_cache_policy - key: ${CI_COMMIT_REF_SLUG} + key: + files: + - mix.lock paths: - deps - _build @@ -22,18 +24,35 @@ stages: - docker before_script: - - apt-get update && apt-get install -y cmake - - mix local.hex --force - - mix local.rebar --force - - apt-get -qq update - - apt-get install -y libmagic-dev + - echo $MIX_ENV + - rm -rf _build/*/lib/pleroma + - mix deps.get + +after_script: + - rm -rf _build/*/lib/pleroma build: stage: build + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" script: - - mix deps.get - mix compile --force +spec-build: + stage: test + only: + changes: + - "lib/pleroma/web/api_spec/**/*.ex" + - "lib/pleroma/web/api_spec.ex" + artifacts: + paths: + - spec.json + script: + - mix pleroma.openapi_spec spec.json + benchmark: stage: benchmark when: manual @@ -44,29 +63,51 @@ benchmark: alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: - - mix deps.get - mix ecto.create - mix ecto.migrate - mix pleroma.load_testing unit-testing: stage: test - retry: 2 + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" cache: &testing_cache_policy <<: *global_cache_policy policy: pull services: - - name: postgres:9.6 + - name: postgres:13 alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: - - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - - mix deps.get - mix ecto.create - mix ecto.migrate - mix coveralls --preload-modules +unit-testing-erratic: + stage: test + retry: 2 + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" + cache: &testing_cache_policy + <<: *global_cache_policy + policy: pull + + services: + - name: postgres:13 + alias: postgres + command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] + script: + - mix ecto.create + - mix ecto.migrate + - mix test --only=erratic + # Removed to fix CI issue. In this early state it wasn't adding much value anyway. # TODO Fix and reinstate federated testing # federated-testing: @@ -85,7 +126,11 @@ unit-testing: unit-testing-rum: stage: test - retry: 2 + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" cache: *testing_cache_policy services: - name: minibikini/postgres-with-rum:12 @@ -95,26 +140,57 @@ unit-testing-rum: <<: *global_variables RUM_ENABLED: "true" script: - - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - - mix deps.get - mix ecto.create - mix ecto.migrate - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/" - mix test --preload-modules lint: + image: elixir:1.12 stage: test + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" cache: *testing_cache_policy + before_script: + - mix local.hex --force + - mix local.rebar --force + - mix deps.get script: - mix format --check-formatted analysis: stage: test + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" cache: *testing_cache_policy script: - - mix deps.get - mix credo --strict --only=warnings,todo,fixme,consistency,readability +cycles: + stage: test + image: elixir:1.11 + only: + changes: + - "**/*.ex" + - "**/*.exs" + - "mix.lock" + cache: {} + before_script: + - mix local.hex --force + - mix local.rebar --force + - mix deps.get + - apt-get update + - apt-get install cmake libmagic-dev -y + script: + - mix compile + - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}' + docs-deploy: stage: deploy cache: *testing_cache_policy @@ -155,6 +231,20 @@ review_app: - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master +spec-deploy: + stage: deploy + artifacts: + paths: + - spec.json + only: + - develop@pleroma/pleroma + image: alpine:latest + before_script: + - apk add curl + script: + - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline + + stop_review_app: image: alpine:3.9 stage: deploy @@ -175,7 +265,7 @@ stop_review_app: amd64: stage: release - image: elixir:1.10.3 + image: elixir:1.10.4 only: &release-only - stable@pleroma/pleroma - develop@pleroma/pleroma @@ -213,7 +303,7 @@ amd64-musl: stage: release artifacts: *release-artifacts only: *release-only - image: elixir:1.10.3-alpine + image: elixir:1.10.4-alpine cache: *release-cache variables: *release-variables before_script: &before-release-musl @@ -228,8 +318,8 @@ arm: artifacts: *release-artifacts only: *release-only tags: - - arm32 - image: arm32v7/elixir:1.10.3 + - arm32-specified + image: arm32v7/elixir:1.10.4 cache: *release-cache variables: *release-variables before_script: *before-release @@ -240,8 +330,8 @@ arm-musl: artifacts: *release-artifacts only: *release-only tags: - - arm32 - image: arm32v7/elixir:1.10.3-alpine + - arm32-specified + image: arm32v7/elixir:1.10.4-alpine cache: *release-cache variables: *release-variables before_script: *before-release-musl @@ -253,7 +343,7 @@ arm64: only: *release-only tags: - arm - image: arm64v8/elixir:1.10.3 + image: arm64v8/elixir:1.10.4 cache: *release-cache variables: *release-variables before_script: *before-release @@ -265,7 +355,7 @@ arm64-musl: only: *release-only tags: - arm - image: arm64v8/elixir:1.10.3-alpine + image: arm64v8/elixir:1.10.4-alpine cache: *release-cache variables: *release-variables before_script: *before-release-musl @@ -283,8 +373,8 @@ docker: IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable - DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64 - DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b + DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 + DOCKER_BUILDX_HASH: 980e6b9655f971991fbbb5fd6cd19f1672386195 before_script: &before-docker - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker pull $IMAGE_TAG_SLUG || true @@ -349,3 +439,26 @@ docker-release: - dind only: - /^release/.*$/@pleroma/pleroma + +docker-adhoc: + stage: docker + image: docker:latest + cache: {} + dependencies: [] + variables: *docker-variables + before_script: *before-docker + allow_failure: true + script: + script: + - mkdir -p /root/.docker/cli-plugins + - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx + - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c + - chmod +x ~/.docker/cli-plugins/docker-buildx + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - docker buildx create --name mbuilder --driver docker-container --use + - docker buildx inspect --bootstrap + - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG . + tags: + - dind + only: + - /^build-docker/.*$/@pleroma/pleroma