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
|
2020-11-11 17:38:42 +00:00
|
|
|
NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/npm
|
2020-11-11 18:00:15 +00:00
|
|
|
GCLOUD_SERVICE_ACCOUNT: /dev/null
|
2020-11-12 03:48:35 +00:00
|
|
|
GCLOUD_DEPLOY_PATH: gs://download.gridtracker.org/staging/$CI_COMMIT_TAG
|
2020-11-10 22:54:15 +00:00
|
|
|
|
2020-11-11 05:57:38 +00:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
2020-11-11 18:00:15 +00:00
|
|
|
- package
|
2020-11-11 05:57:38 +00:00
|
|
|
- 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-11 18:00:15 +00:00
|
|
|
# just do a quick syntax check job, we don't need to "build" anything here
|
|
|
|
npm_test:
|
|
|
|
stage: test
|
|
|
|
image: node:latest
|
|
|
|
script:
|
|
|
|
- npm install
|
|
|
|
- npm test
|
|
|
|
|
|
|
|
# test2:
|
|
|
|
# stage: test
|
|
|
|
# script:
|
|
|
|
# - echo "Do another parallel test here"
|
|
|
|
# - echo "For example run a lint test"
|
|
|
|
|
|
|
|
|
|
|
|
# if we've been tagged with a tag starting with v or test_, package binaries and create
|
|
|
|
# build artifacts
|
2020-11-11 00:34:09 +00:00
|
|
|
|
2020-11-11 18:00:15 +00:00
|
|
|
packaging:
|
|
|
|
stage: package
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^(v|test_).*/'
|
|
|
|
artifacts:
|
|
|
|
paths:
|
2020-11-11 18:35:41 +00:00
|
|
|
- build/
|
2020-11-11 18:00:15 +00:00
|
|
|
name: '$CI_COMMIT_REF_SLUG'
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .cache/
|
|
|
|
- node_modules/
|
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- package.json
|
|
|
|
- package.nw/package.json
|
2020-11-04 01:22:11 +00:00
|
|
|
script:
|
2020-11-11 18:00:15 +00:00
|
|
|
- mkdir -p $APT_CACHE_DIR $NPM_CONFIG_CACHE
|
|
|
|
- mkdir -p build/debian
|
|
|
|
- dpkg --add-architecture i386
|
|
|
|
- apt-get -qq update
|
|
|
|
- apt-get -qq -o dir::cache::archives="$APT_CACHE_DIR" install -y npm wine wine32
|
|
|
|
- npm install --prefer-offline
|
|
|
|
- npm run dist
|
|
|
|
- (cd dist ; mv *.zip *.exe *.7z *.json ../build)
|
|
|
|
- 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 .
|
|
|
|
- dpkg-buildpackage -uc -us
|
|
|
|
- mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/
|
2020-11-04 20:29:13 +00:00
|
|
|
|
2020-11-11 18:00:15 +00:00
|
|
|
# copy the assets over to our distribution storage
|
|
|
|
staging_upload:
|
|
|
|
stage: deploy
|
|
|
|
image: google/cloud-sdk:alpine
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^(v|test_).*/'
|
|
|
|
script:
|
|
|
|
- echo "This will be the upload script for $CI_COMMIT_TAG"
|
2020-11-11 18:35:41 +00:00
|
|
|
- echo copying to $GCLOUD_DEPLOY_PATH
|
2020-11-11 18:00:15 +00:00
|
|
|
- gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT
|
2020-11-12 03:24:24 +00:00
|
|
|
- cd build; gsutil -m rsync -r . $GCLOUD_DEPLOY_PATH
|
2020-11-11 18:00:15 +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:
|
|
|
|
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'
|