gitbeaker/.gitlab-ci.yml
Justin Dalrymple 6a3292b033
Expose typing to consumer and remove export complexity (#1818)
- Exports all types
- Clean up type duplicates
- Remove Project,User and Group Bundles
- Fix typing on the Gitlab Export
- Clean up README.md
2021-07-05 15:34:19 -04:00

168 lines
4.4 KiB
YAML

default:
image: node:lts-alpine
# Cache modules in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- packages/gitbeaker-core/node_modules/
- packages/gitbeaker-cli/node_modules/
- packages/gitbeaker-browser/node_modules/
- packages/gitbeaker-node/node_modules/
- packages/gitbeaker-requester-utils/node_modules/
- node_modules/
stages:
- install
- build
- lint
- test
- canary
- release
#Link and Install all required dependancies
install:
image: node:lts
stage: install
variables:
PLAYWRIGHT_BROWSERS_PATH: 0
script:
- yarn
# Build core (cjs, es, and browser) and cli packages
# Uses work around to allow for linking of the cli packages
build:
stage: build
script:
- yarn build
artifacts:
paths:
- packages/core/dist/
- packages/cli/dist/
- packages/browser/dist/
- packages/node/dist/
- packages/requester-utils/dist/
# Lint all code, tests and supporting documentation (README, CHANGELOG etc)
lint:src:
needs: ['install']
stage: lint
script: yarn lint
lint:docs:
needs: ['install']
stage: lint
script: yarn lint:docs
# Unit Tests
test:unit:cli:
needs: ['install']
stage: test
script: yarn workspace @gitbeaker/cli test:unit && yarn codecov -F cli
test:unit:core:
needs: ['install']
stage: test
script: yarn workspace @gitbeaker/core test:unit && yarn codecov -F core
test:unit:node:
needs: ['install']
stage: test
script: yarn workspace @gitbeaker/node test:unit && yarn codecov -F node
test:unit:browser:
needs: ['install']
stage: test
image: mcr.microsoft.com/playwright:bionic
variables:
PLAYWRIGHT_BROWSERS_PATH: 0
script: yarn workspace @gitbeaker/browser test:unit && yarn codecov -F browser
test:unit:utils:
needs: ['install']
stage: test
script: yarn workspace @gitbeaker/requester-utils test:unit && yarn codecov -F utils
#Integration Tests
# .test:integration: &integration-test
# stage: test
# needs: ['build']
# image:
# name: jdalrymple/docker-compose-with-node
# entrypoint: ['/bin/sh', '-c']
# variables:
# GITLAB_PERSONAL_ACCESS_TOKEN: superduperstrongtoken
# DOCKER_HOST: tcp://docker:2375
# GITLAB_URL: http://docker:8080
# services:
# - docker:dind
# retry: 2
# timeout: 45 minutes
# before_script:
# - apk add jq curl
#
# # Spin up container
# - docker-compose -f scripts/docker-compose.yml up -d
#
# # Verify Gitlab instance is up and running
# - echo "Waiting for service to start"
# - sleep 180
# - while [[ "$(curl --fail --silent -X GET "$GITLAB_URL/-/readiness?all=1" --insecure | jq -r '.master_check[0].status')" != "ok" ]]; do echo "Polling service - not alive yet"; sleep 10; done;
# - echo "Service is up and running!"
# after_script:
# - sleep 30
# - docker cp gitlab:/var/log/gitlab runner_logs
# - echo $(docker exec -i gitlab sh -c "grep -v -e '^#' -e '^$' /etc/gitlab/gitlab.rb") > runner_logs/gitlab.rb
# artifacts:
# when: on_failure
# paths:
# - runner_logs
# test:integration:browser:
# <<: *integration-test
# image: mcr.microsoft.com/playwright:bionic
# variables:
# PLAYWRIGHT_BROWSERS_PATH: 0
# script:
# - yarn workspace @gitbeaker/browser test:integration
# test:integration:
# <<: *integration-test
# script:
# - yarn workspace @gitbeaker/cli test:integration
# - yarn workspace @gitbeaker/node test:integration
# Canary
canary:
stage: canary
only:
- external_pull_requests
before_script:
- apk add --no-cache git
- git remote set-url origin https://jdalrymple:${GITHUB_TOKEN}@github.com/jdalrymple/gitbeaker.git
- git checkout $CI_COMMIT_REF_NAME
- npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
- npm config set always-auth=true
script: |
if yarn auto label --pr $CI_EXTERNAL_PULL_REQUEST_IID | grep 'canary'; then
echo "canary label found, starting canary deployment!"
yarn auto canary
else
echo "Skipping, canary label isn't present."
fi
# Release
release:
needs: ['build']
only:
refs:
- master
stage: release
before_script:
- apk add --no-cache git
- git remote set-url origin https://jdalrymple:${GITHUB_TOKEN}@github.com/jdalrymple/gitbeaker.git
- git checkout master
- npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
- npm config set always-auth=true
script: yarn release