gridtracker/.gitlab-ci.yml

92 wiersze
2.3 KiB
YAML

# 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
variables:
DEFAULT_IMAGE: debian:stable
APT_CACHE_DIR: $CI_PROJECT_DIR/.cache/apt
NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/.npm
EXTRA_DESCRIPTION: ''
# only run for merge requests and tags
include:
- template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
default:
image: ${DEFAULT_IMAGE}
interruptible: true
cache: &global_cache
paths:
- .cache/
- node_modules/
key:
files:
- package.json
- package.nw/package.json
before_script:
- mkdir -p $APT_CACHE_DIR $NPM_CONFIG_CACHE
build_job:
stage: build
rules:
- if: $CI_COMMIT_TAG =~ /^(v|test_).*/
artifacts:
paths:
- build/*
script:
- env
- dpkg --add-architecture i386
- apt-get -yq update
- apt-get -yq -o dir::cache::archives="$APT_CACHE_DIR" install npm wine wine32
- npm install --prefer-offline
- npm run dist
- mkdir build
- (cd package.nw/dist ; mv *.zip *.exe *.7z *.json ../../build)
- apt-get -yq -o dir::cache::archives="$APT_CACHE_DIR" install build-essential devscripts
- apt-get -yq -o dir::cache::archives="$APT_CACHE_DIR" build-dep .
- dpkg-buildpackage -uc -us
- mkdir -p build/debian
- mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/
- ls -R `pwd`/.cache
test_job:
stage: test
cache:
<<: *global_cache
policy: pull
script:
- apt-get update
- apt-get -yq -o dir::cache::archives="$APT_CACHE_DIR" install npm
- rm -rf package.nw/dist
- npm install --prefer-offline
- npm test
release_job:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG =~ /^(v|test_).*/ && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
needs:
- job: build_job
script:
- echo 'Release for $CI_COMMIT_TAG'
release:
name: 'Release $CI_COMMIT_TAG'
description: debian/changelog
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_SHA'
# test2:
# stage: test
# script:
# - echo "Do another parallel test here"
# - echo "For example run a lint test"
#
# deploy1:
# stage: deploy
# only:
# - tags
# script:
# - echo "Do your deploy here"