CI: Sync with Mapillary

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head
Taylor Smock 2021-09-30 15:17:13 -06:00
rodzic 849f571837
commit 136e55ea6d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
1 zmienionych plików z 129 dodań i 39 usunięć

Wyświetl plik

@ -1,13 +1,16 @@
image: registry.gitlab.com/josm/docker-library/openjdk-8-josmplugin:latest image: registry.gitlab.com/josm/docker-library/openjdk-8-josmplugin:latest
before_script: variables:
- export GRADLE_USER_HOME=`pwd`/.gradle GIT_SUBMODULE_STRATEGY: recursive
cache: cache: &global_cache
paths: paths:
- .gradle/wrapper - .gradle/wrapper
- .gradle/caches - .gradle/caches
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
############################# #############################
# Various additional Checks # # Various additional Checks #
############################# #############################
@ -15,17 +18,28 @@ include:
- template: Code-Quality.gitlab-ci.yml - template: Code-Quality.gitlab-ci.yml
- template: SAST.gitlab-ci.yml - template: SAST.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml - template: Dependency-Scanning.gitlab-ci.yml
- template: License-Scanning.gitlab-ci.yml
# - template: Container-Scanning.gitlab-ci.yml # - template: Container-Scanning.gitlab-ci.yml
# - template: DAST.gitlab-ci.yml # - template: DAST.gitlab-ci.yml
# - template: License-Management.gitlab-ci.yml
stages:
- build
- test
- deploy
- release
sast: sast:
variables: {} variables: {}
variables: variables:
GRADLE_PATH: "./gradlew" GRADLE_PATH: "./gradlew"
FAIL_NEVER: 1 FAIL_NEVER: 1
SAST_EXCLUDED_PATHS: ".gradle"
# CI_DEBUG_TRACE: "true" # CI_DEBUG_TRACE: "true"
variables:
PLUGIN_NAME: "MapWithAI"
PLUGIN_JAR_BASE_NAME: "mapwithai"
############### ###############
# Build stage # # Build stage #
############### ###############
@ -36,7 +50,7 @@ assemble:
- ./gradlew assemble --stacktrace - ./gradlew assemble --stacktrace
artifacts: artifacts:
paths: paths:
- build/ - build/
expire_in: 1 day expire_in: 1 day
interruptible: true interruptible: true
@ -69,7 +83,7 @@ code_navigation:
- apk add --update curl bash - apk add --update curl bash
- curl -fLo coursier https://git.io/coursier-cli - curl -fLo coursier https://git.io/coursier-cli
- chmod +x coursier - chmod +x coursier
- ./coursier launch com.sourcegraph:lsif-java_2.13:0.5.4 -- index --build-tool gradle - ./coursier launch com.sourcegraph:lsif-java_2.13:0.5.6 -- index --build-tool gradle
artifacts: artifacts:
reports: reports:
lsif: dump.lsif lsif: dump.lsif
@ -78,6 +92,9 @@ code_navigation:
when: always when: always
allow_failure: true allow_failure: true
interruptible: true interruptible: true
cache:
<<: *global_cache
policy: pull
############## ##############
# Test stage # # Test stage #
@ -86,7 +103,7 @@ code_navigation:
build: build:
stage: test stage: test
script: script:
- ./gradlew build generatePot generateSnapshotUpdateSite --stacktrace - ./gradlew build --stacktrace #--info
artifacts: artifacts:
paths: paths:
- build - build
@ -124,6 +141,21 @@ coverage:
reports: reports:
cobertura: "build/reports/jacoco/test/coverage.xml" cobertura: "build/reports/jacoco/test/coverage.xml"
interruptible: true interruptible: true
cache:
<<: *global_cache
policy: pull
translate:
stage: test
script:
- ./gradlew generatePot --stacktrace
artifacts:
paths:
- build
needs: ["assemble"]
cache:
<<: *global_cache
policy: pull
compile against min JOSM: compile against min JOSM:
stage: test stage: test
@ -133,6 +165,10 @@ compile against min JOSM:
dependencies: dependencies:
- assemble - assemble
interruptible: true interruptible: true
allow_failure: true # It should still run against it, but there are some methods if'd around
cache:
<<: *global_cache
policy: pull
compile against latest JOSM: compile against latest JOSM:
stage: test stage: test
@ -142,6 +178,9 @@ compile against latest JOSM:
dependencies: dependencies:
- assemble - assemble
interruptible: true interruptible: true
cache:
<<: *global_cache
policy: pull
build with java 11: build with java 11:
stage: test stage: test
@ -153,6 +192,9 @@ build with java 11:
dependencies: dependencies:
- assemble with java 11 - assemble with java 11
interruptible: true interruptible: true
cache:
<<: *global_cache
policy: pull
build with java 17: build with java 17:
stage: test stage: test
@ -165,45 +207,90 @@ build with java 17:
dependencies: dependencies:
- assemble with java 17 - assemble with java 17
interruptible: true interruptible: true
cache:
<<: *global_cache
policy: pull
################ ################
# Deploy stage # # Deploy stage #
################ ################
#upload to transifex: transifex.com:
# image: python:3.6-stretch image: registry.gitlab.com/josm/docker-library/python-transifex:latest
# stage: deploy stage: deploy
# environment: environment:
# name: transifex name: transifex.com
# url: https://www.transifex.com/josm/josm/josm-plugin_mapwithai/ url: https://www.transifex.com/josm/josm/josm-plugin_$PLUGIN_NAME/
# before_script: script:
# - apt-get update && apt-get install -yq gettext git - TX_TOKEN="$TRANSIFEX_TOKEN" tx push -s --no-interactive
# - pip install git+https://github.com/transifex/transifex-client.git needs: ["translate"]
# script: only:
# - TX_TOKEN="$TRANSIFEX_TOKEN" tx push -s --no-interactive refs:
# needs: ["assemble"] - master
# only: variables:
# - master - $TRANSIFEX_TOKEN
# interruptible: true cache:
<<: *global_cache
policy: pull
codecov.io:
image: alpine:3.10
stage: deploy
environment:
name: codecov.io
url: https://codecov.io/gh/JOSM/$PLUGIN_NAME
before_script:
- apk add --update curl bash
script:
- curl -s https://codecov.io/bash | bash
- curl -s https://codecov.io/bash | bash /dev/stdin -c -F model_and_api
needs: ["build"]
only:
refs:
- master
variables:
- $CODECOV_TOKEN
sonarcloud.io: sonarcloud.io:
image: registry.gitlab.com/josm/docker-library/openjdk-11-josmplugin:latest image: registry.gitlab.com/josm/docker-library/openjdk-11-josmplugin:latest
stage: deploy stage: deploy
environment: environment:
name: sonarcloud.io name: sonarcloud.io
url: https://sonarcloud.io/dashboard?id=mapwithai url: https://sonarcloud.io/dashboard?id=$PLUGIN_NAME
script: script:
- git fetch --unshallow || echo "Already unshallowed?" - git fetch --unshallow || echo "Already unshallowed"
- ./gradlew -Dsonar.login=$SONAR_TOKEN sonarqube - ./gradlew -Dsonar.login=$SONAR_TOKEN sonarqube
needs: ["test"] needs: ["test"]
dependencies: dependencies:
- test - test
only: only:
refs:
- $CI_DEFAULT_BRANCH
variables: variables:
- $SONAR_TOKEN =~ /[0-9a-z]+/ - $SONAR_TOKEN =~ /[0-9a-z]+/
release: GitLab Maven repo:
stage: deploy stage: deploy
environment:
name: GitLab.com / Maven packages
url: $CI_PROJECT_URL/-/packages
script:
- ./gradlew publishAllPublicationsToGitlabRepository
needs: ["build", "compile against min JOSM", "compile against latest JOSM"]
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != "schedule"'
when: always
cache:
<<: *global_cache
policy: pull
#################
# Release stage #
#################
release:
stage: release
environment: environment:
name: pages branch / dist directory name: pages branch / dist directory
url: ${CI_PAGES_URL}/${CI_PROJECT_NAME} url: ${CI_PAGES_URL}/${CI_PROJECT_NAME}
@ -228,15 +315,18 @@ release:
git stage . git stage .
git commit -a -m "$commitMessage" git commit -a -m "$commitMessage"
git push origin pages git push origin pages
needs: ["compile against min JOSM", "compile against latest JOSM", "build"] needs: ["build", "compile against min JOSM", "compile against latest JOSM"]
dependencies: dependencies:
- build - build
rules: rules:
- if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != "schedule"' - if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != "schedule"'
when: manual when: manual
cache:
<<: *global_cache
policy: pull
release hotfix: release hotfix:
stage: deploy stage: release
environment: environment:
name: pages branch / dist directory name: pages branch / dist directory
url: ${CI_PAGES_URL}/${CI_PROJECT_NAME} url: ${CI_PAGES_URL}/${CI_PROJECT_NAME}
@ -255,7 +345,7 @@ release hotfix:
when: always when: always
publish update site: publish update site:
stage: deploy stage: release
environment: environment:
name: pages branch / snapshot update site name: pages branch / snapshot update site
url: ${CI_PAGES_URL}/${CI_PROJECT_NAME}/snapshot/${CI_COMMIT_REF_NAME}/update-site url: ${CI_PAGES_URL}/${CI_PROJECT_NAME}/snapshot/${CI_COMMIT_REF_NAME}/update-site
@ -269,7 +359,7 @@ publish update site:
mkdir -pv "pages/public/snapshot/${CI_COMMIT_REF_NAME}" mkdir -pv "pages/public/snapshot/${CI_COMMIT_REF_NAME}"
cp -v "build/snapshot-update-site" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/update-site" cp -v "build/snapshot-update-site" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/update-site"
cp -v "build/dist/"* "pages/public/snapshot/${CI_COMMIT_REF_NAME}" cp -v "build/dist/"* "pages/public/snapshot/${CI_COMMIT_REF_NAME}"
cp -v "build/dist/mapwithai.jar" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/mapwithai-dev.jar" cp -v "build/dist/${PLUGIN_JAR_BASE_NAME}.jar" "pages/public/snapshot/${CI_COMMIT_REF_NAME}/${PLUGIN_JAR_BASE_NAME}-dev.jar"
- *push_pages_branch - *push_pages_branch
needs: ["compile against min JOSM", "compile against latest JOSM", "build"] needs: ["compile against min JOSM", "compile against latest JOSM", "build"]
dependencies: dependencies:
@ -278,17 +368,17 @@ publish update site:
- if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_REF_NAME != null' - if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_REF_NAME != null'
when: always when: always
publish to / GitLab.com packages: release to Gitlab.com:
stage: deploy stage: release
environment: environment:
name: GitLab.com / ${CI_PROJECT_NAME} packages name: GitLab.com / Releases
url: ${CI_PROJECT_URL}/-/packages url: $CI_PROJECT_URL/-/releases
script: script:
- ./gradlew publishAllPublicationsToGitlabRepository - ./gradlew releaseToGitlab
- ./gradlew releaseToGitlab needs: ["GitLab Maven repo"]
needs: ["compile against min JOSM", "compile against latest JOSM", "build"]
dependencies:
- build
rules: rules:
- if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != "schedule"' - if: '$SSH_PRIVATE_DEPLOY_KEY != null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
when: always when: always
cache:
<<: *global_cache
policy: pull