Give full CI/CD a shot now that tags are protected.

Canadian-Provinces-Territories-Award-Layer
Paul Traina 2020-11-11 10:00:15 -08:00
rodzic 55e469e6ed
commit e19ba69143
1 zmienionych plików z 76 dodań i 106 usunięć

Wyświetl plik

@ -5,12 +5,12 @@ variables:
DEFAULT_IMAGE: debian:stable DEFAULT_IMAGE: debian:stable
APT_CACHE_DIR: $CI_PROJECT_DIR/.cache/apt APT_CACHE_DIR: $CI_PROJECT_DIR/.cache/apt
NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/npm NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/npm
EXTRA_DESCRIPTION: '' GCLOUD_SERVICE_ACCOUNT: /dev/null
stages: stages:
- precheck
- build - build
- test - test
- package
- deploy - deploy
# only run for merge requests and tags # only run for merge requests and tags
@ -21,110 +21,80 @@ default:
image: ${DEFAULT_IMAGE} image: ${DEFAULT_IMAGE}
interruptible: true interruptible: true
cache: &global_cache
paths:
- .cache/
- node_modules/
key:
files:
- package.json
- package.nw/package.json
before_script: # just do a quick syntax check job, we don't need to "build" anything here
- mkdir -p $APT_CACHE_DIR $NPM_CONFIG_CACHE npm_test:
stage: test
# quick variable test image: node:latest
test_variable:
stage: precheck
script: script:
- echo $CI_JOB_STAGE - npm install
- env - npm test
- echo $GCLOUD_SERVICE_ACCOUNT
- cat $GCLOUD_SERVICE_ACCOUNT
## just do a quick syntax check job # test2:
#code_test_job: # stage: test
# stage: precheck # script:
# image: node:latest # - echo "Do another parallel test here"
# cache: {} # - echo "For example run a lint test"
# script:
# - npm install
# - npm test # if we've been tagged with a tag starting with v or test_, package binaries and create
# # build artifacts
## if we've been tagged with a tag starting with v or test_, build some binaries for
## and leave them in the build artifacts packaging:
#build_job: stage: package
# stage: build rules:
# rules: - if: '$CI_COMMIT_TAG =~ /^(v|test_).*/'
# - if: '$CI_COMMIT_TAG =~ /^(v|test_).*/' artifacts:
# artifacts: paths:
# paths: - build/*
# - build/* name: '$CI_COMMIT_REF_SLUG'
# name: '$CI_COMMIT_REF_SLUG' cache:
# script: paths:
# - mkdir -p build/debian - .cache/
# - dpkg --add-architecture i386 - node_modules/
# - apt-get -qq update key:
# - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm wine wine32 files:
# - npm install --prefer-offline - package.json
# - npm run dist - package.nw/package.json
# - (cd dist ; mv *.zip *.exe *.7z *.json ../build) script:
# - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y build-essential devscripts - mkdir -p $APT_CACHE_DIR $NPM_CONFIG_CACHE
# - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" build-dep . - mkdir -p build/debian
# - dpkg-buildpackage -uc -us - dpkg --add-architecture i386
# - mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/ - apt-get -qq update
# - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm wine wine32
## currently we run syntax checking before we even attempt builds - npm install --prefer-offline
## this is left as an example placeholder for post-build tests - npm run dist
## - (cd dist ; mv *.zip *.exe *.7z *.json ../build)
## test1: - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y build-essential devscripts
## stage: test - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" build-dep .
## cache: - dpkg-buildpackage -uc -us
## <<: *global_cache - mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/
## policy: pull
## script: # copy the assets over to our distribution storage
## - apt-get -qq update staging_upload:
## - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm stage: deploy
## - npm install --prefer-offline image: google/cloud-sdk:alpine
## - npm test rules:
## - if: '$CI_COMMIT_TAG =~ /^(v|test_).*/'
## test2: script:
## stage: test - echo "This will be the upload script for $CI_COMMIT_TAG"
## script: - gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT
## - echo "Do another parallel test here" - echo build artifacts ----
## - echo "For example run a lint test" - ls -R build
## - echo copying
# - gsutil -m --project=gridtracker rsync build/* gs://gridtracker_dltest/$CI_COMMIT_TAG/
## copy the assets over to our build server
#staging_upload: # this only creates a "source code release" -- gitlab doesn't specify binaries
# stage: deploy # except as links to external storage, which is suboptimal for now
# image: google/cloud-sdk:alpine source_release:
# rules: stage: deploy
# - if: '$CI_COMMIT_TAG =~ /^test_.*/' image: registry.gitlab.com/gitlab-org/release-cli:latest
# cache: {} rules:
# script: - if: '$CI_COMMIT_TAG =~ /^v.*/'
# - echo "This will be the upload script for $CI_COMMIT_TAG" script:
# - env - echo 'Release for $CI_COMMIT_TAG'
# - echo "Credentials in $GCLOUD_SERVICE_ACCOUNT" release:
# - cat $GCLOUD_SERVICE_ACCOUNT name: 'GridTracker $CI_COMMIT_TAG'
# - gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT description: 'GridTracker source $CI_COMMIT_TAG'
# - echo build artifacts ---- tag_name: '$CI_COMMIT_TAG'
# - ls -R build ref: '$CI_COMMIT_SHA'
# - echo copying
# - gsutil -m --project=gridtracker rsync build/* gs://gridtracker_dltest/$CI_COMMIT_TAG
#
## this only creates a "source code release" -- gitlab doesn't specify binaries
## except as links to external storage, which is suboptimal for now
#source_release:
# stage: deploy
# image: registry.gitlab.com/gitlab-org/release-cli:latest
# rules:
# - if: '$CI_COMMIT_TAG =~ /^v.*/'
# script:
# - echo 'Release for $CI_COMMIT_TAG'
# release:
# name: 'GridTracker $CI_COMMIT_TAG'
# description: 'GridTracker source $CI_COMMIT_TAG'
# tag_name: '$CI_COMMIT_TAG'
# ref: '$CI_COMMIT_SHA'
#