Skip to content

Commit

Permalink
wip: adding back child pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacasolin committed Jun 7, 2022
1 parent 631a0da commit 223158b
Showing 1 changed file with 102 additions and 75 deletions.
177 changes: 102 additions & 75 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stages:
- check # Linting, unit tests
- build # Cross-platform library compilation, unit tests
- integration # Cross-platform application bundling, integration tests, and pre-release
- release # Cross-platform distribution and deployment
# - release # Cross-platform distribution and deployment

image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner

Expand Down Expand Up @@ -72,9 +72,31 @@ check:nix-dry:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual

check:test-generate:
stage: check
interruptible: true
script:
- mkdir -p ./tmp
- >
nix-shell -I nixpkgs=./pkgs.nix --packages bash --run '
./scripts/test-pipelines.sh > ./tmp/test-pipelines.yml
'
artifacts:
when: always
paths:
- ./tmp/test-pipelines.yml
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# Manually run on commits other than master and staging and ignore version commits
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
when: manual

check:test:
stage: check
needs: []
needs: [
- check:test-generate
]
script:
- >
nix-shell --run '
Expand All @@ -90,6 +112,11 @@ check:test:
coverage_format: cobertura
path: ./tmp/coverage/cobertura-coverage.xml
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
trigger:
include:
- artifact: tmp/test-pipelines.yml
job: test-generate
strategy: depend
rules:
# Runs on staging commits and ignores version commits
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
Expand Down Expand Up @@ -476,78 +503,78 @@ integration:prerelease:
# # Runs on tag pipeline where the tag is a prerelease or release version
# - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

release:deployment:branch:
stage: release
# Only needs integration:builds from the staging branch pipeline
needs:
- project: $CI_PROJECT_PATH
job: integration:builds
ref: staging
artifacts: true
# Don't interrupt deploying job
interruptible: false
# Requires mutual exclusion (also with release:deployment:tag)
resource_group: release:deployment
script:
- echo 'Perform service deployment for production'
rules:
# Runs on master commits and ignores version commits
- if: $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
# release:deployment:branch:
# stage: release
# # Only needs integration:builds from the staging branch pipeline
# needs:
# - project: $CI_PROJECT_PATH
# job: integration:builds
# ref: staging
# artifacts: true
# # Don't interrupt deploying job
# interruptible: false
# # Requires mutual exclusion (also with release:deployment:tag)
# resource_group: release:deployment
# script:
# - echo 'Perform service deployment for production'
# rules:
# # Runs on master commits and ignores version commits
# - if: $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

release:deployment:tag:
stage: release
# Tag pipelines run independently
needs:
- integration:builds
- integration:merge
# Don't interrupt deploying job
interruptible: false
# Requires mutual exclusion (also with release:deployment:branch)
resource_group: release:deployment
script:
- echo 'Perform service deployment for production'
rules:
# Runs on tag pipeline where the tag is a release version
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/
# release:deployment:tag:
# stage: release
# # Tag pipelines run independently
# needs:
# - integration:builds
# - integration:merge
# # Don't interrupt deploying job
# interruptible: false
# # Requires mutual exclusion (also with release:deployment:branch)
# resource_group: release:deployment
# script:
# - echo 'Perform service deployment for production'
# rules:
# # Runs on tag pipeline where the tag is a release version
# - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/

release:distribution:
stage: release
needs:
- build:linux
- build:windows
- build:macos
- integration:builds
- integration:merge
- release:deployment:tag
# Don't interrupt publishing job
interruptible: false
before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
script:
- echo 'Publishing library & application release'
- >
nix-shell --run '
npm publish --access public;
'
- >
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
gh release \
create "$CI_COMMIT_TAG" \
builds/*.closure.gz \
builds/*-docker-* \
builds/*-linux-* \
builds/*-win-* \
builds/*-macos-* \
--title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--notes "" \
--target master \
--repo "$GH_PROJECT_PATH";
'
after_script:
- rm -f ./.npmrc
rules:
# Only runs on tag pipeline where the tag is a release version
# This requires dependencies to also run on tag pipeline
# However version tag comes with a version commit
# Dependencies must not run on the version commit
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/
# release:distribution:
# stage: release
# needs:
# - build:linux
# - build:windows
# - build:macos
# - integration:builds
# - integration:merge
# - release:deployment:tag
# # Don't interrupt publishing job
# interruptible: false
# before_script:
# - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
# script:
# - echo 'Publishing library & application release'
# - >
# nix-shell --run '
# npm publish --access public;
# '
# - >
# nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
# gh release \
# create "$CI_COMMIT_TAG" \
# builds/*.closure.gz \
# builds/*-docker-* \
# builds/*-linux-* \
# builds/*-win-* \
# builds/*-macos-* \
# --title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
# --notes "" \
# --target master \
# --repo "$GH_PROJECT_PATH";
# '
# after_script:
# - rm -f ./.npmrc
# rules:
# # Only runs on tag pipeline where the tag is a release version
# # This requires dependencies to also run on tag pipeline
# # However version tag comes with a version commit
# # Dependencies must not run on the version commit
# - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/

0 comments on commit 223158b

Please sign in to comment.