2020-11-04 01:22:11 +00:00
|
|
|
# This file is a template, and might need editing before it works on your project.
|
|
|
|
# see https://docs.gitlab.com/ee/ci/yaml/README.html for all available options
|
|
|
|
|
2020-11-04 01:40:43 +00:00
|
|
|
variables:
|
|
|
|
DEFAULT_IMAGE: debian:stable
|
2020-11-11 00:34:09 +00:00
|
|
|
APT_CACHE_DIR: $CI_PROJECT_DIR/.cache/apt
|
|
|
|
NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/.npm
|
2020-11-10 22:54:15 +00:00
|
|
|
EXTRA_DESCRIPTION: ''
|
|
|
|
|
2020-11-11 05:57:38 +00:00
|
|
|
stages:
|
|
|
|
- precheck
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
|
2020-11-10 22:54:15 +00:00
|
|
|
# only run for merge requests and tags
|
|
|
|
include:
|
|
|
|
- template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
|
2020-11-04 01:40:43 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
image: ${DEFAULT_IMAGE}
|
|
|
|
interruptible: true
|
2020-11-04 01:22:11 +00:00
|
|
|
|
2020-11-10 23:43:17 +00:00
|
|
|
cache: &global_cache
|
2020-11-10 22:54:15 +00:00
|
|
|
paths:
|
|
|
|
- .cache/
|
2020-11-10 23:43:17 +00:00
|
|
|
- node_modules/
|
2020-11-10 22:54:15 +00:00
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- package.json
|
|
|
|
- package.nw/package.json
|
2020-11-04 01:22:11 +00:00
|
|
|
|
2020-11-11 00:34:09 +00:00
|
|
|
before_script:
|
|
|
|
- mkdir -p $APT_CACHE_DIR $NPM_CONFIG_CACHE
|
|
|
|
|
2020-11-11 05:57:38 +00:00
|
|
|
# just do a quick syntax check job
|
|
|
|
code_test_job:
|
|
|
|
stage: precheck
|
|
|
|
image: node:latest
|
|
|
|
cache: {}
|
|
|
|
script:
|
|
|
|
- npm install
|
|
|
|
- npm test
|
|
|
|
|
|
|
|
# if we've been tagged with a tag starting with v or test_, build some binaries for
|
|
|
|
# and leave them in the build artifacts
|
2020-11-10 23:43:17 +00:00
|
|
|
build_job:
|
2020-11-04 01:22:11 +00:00
|
|
|
stage: build
|
2020-11-10 22:54:15 +00:00
|
|
|
rules:
|
2020-11-11 01:52:17 +00:00
|
|
|
- if: '$CI_COMMIT_TAG =~ /^(v|test_).*/'
|
2020-11-04 01:22:11 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- build/*
|
2020-11-11 05:57:38 +00:00
|
|
|
name: '$CI_COMMIT_REF_SLUG'
|
2020-11-04 01:22:11 +00:00
|
|
|
script:
|
2020-11-11 02:17:40 +00:00
|
|
|
- mkdir -p build/debian
|
2020-11-10 23:43:17 +00:00
|
|
|
- dpkg --add-architecture i386
|
2020-11-11 01:52:17 +00:00
|
|
|
- apt-get -qq update
|
|
|
|
- apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm wine wine32
|
2020-11-10 23:43:17 +00:00
|
|
|
- npm install --prefer-offline
|
2020-11-07 22:58:20 +00:00
|
|
|
- npm run dist
|
2020-11-11 06:48:27 +00:00
|
|
|
- (cd dist ; mv *.zip *.exe *.7z *.json ../build)
|
2020-11-11 01:52:17 +00:00
|
|
|
- apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y build-essential devscripts
|
|
|
|
- apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" build-dep .
|
2020-11-10 23:43:17 +00:00
|
|
|
- dpkg-buildpackage -uc -us
|
|
|
|
- mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/
|
2020-11-04 20:29:13 +00:00
|
|
|
|
2020-11-11 05:57:38 +00:00
|
|
|
# currently we run syntax checking before we even attempt builds
|
|
|
|
# this is left as an example placeholder for post-build tests
|
|
|
|
#
|
|
|
|
# test1:
|
|
|
|
# stage: test
|
|
|
|
# cache:
|
|
|
|
# <<: *global_cache
|
|
|
|
# policy: pull
|
|
|
|
# script:
|
|
|
|
# - apt-get -qq update
|
|
|
|
# - apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm
|
|
|
|
# - npm install --prefer-offline
|
|
|
|
# - npm test
|
|
|
|
#
|
|
|
|
# test2:
|
|
|
|
# stage: test
|
|
|
|
# script:
|
|
|
|
# - echo "Do another parallel test here"
|
|
|
|
# - echo "For example run a lint test"
|
|
|
|
#
|
|
|
|
|
|
|
|
# copy the assets over to our build server
|
|
|
|
staging_upload:
|
|
|
|
stage: deploy
|
2020-11-11 06:21:13 +00:00
|
|
|
image: google/cloud-sdk:alpine
|
2020-11-11 05:57:38 +00:00
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^test_.*/'
|
|
|
|
cache: {}
|
2020-11-10 22:54:15 +00:00
|
|
|
script:
|
2020-11-11 05:57:38 +00:00
|
|
|
- echo "This will be the upload script for $CI_COMMIT_TAG"
|
|
|
|
- env
|
|
|
|
- echo "Credentials in $GCLOUD_SERVICE_ACCOUNT"
|
|
|
|
- cat $GCLOUD_SERVICE_ACCOUNT
|
|
|
|
- gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT
|
|
|
|
- echo build artifacts ----
|
|
|
|
- ls -R build
|
|
|
|
- echo copying
|
|
|
|
- gsutil -m --project=gridtracker rsync build/* gs://gridtracker_dltest/$CI_COMMIT_TAG
|
2020-11-10 22:54:15 +00:00
|
|
|
|
2020-11-11 05:57:38 +00:00
|
|
|
# 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:
|
2020-11-10 22:54:15 +00:00
|
|
|
stage: deploy
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
rules:
|
2020-11-11 05:57:38 +00:00
|
|
|
- if: '$CI_COMMIT_TAG =~ /^v.*/'
|
2020-11-10 22:54:15 +00:00
|
|
|
script:
|
|
|
|
- echo 'Release for $CI_COMMIT_TAG'
|
|
|
|
release:
|
2020-11-11 01:52:17 +00:00
|
|
|
name: 'GridTracker $CI_COMMIT_TAG'
|
2020-11-11 05:57:38 +00:00
|
|
|
description: 'GridTracker source $CI_COMMIT_TAG'
|
2020-11-10 22:54:15 +00:00
|
|
|
tag_name: '$CI_COMMIT_TAG'
|
|
|
|
ref: '$CI_COMMIT_SHA'
|
|
|
|
|