Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
CMCDragonkai committed May 21, 2022
1 parent 4648215 commit 3bac1b4
Showing 1 changed file with 152 additions and 164 deletions.
316 changes: 152 additions & 164 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,182 +39,170 @@ stages:

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

# check:lint:
# stage: check
# needs: []
# script:
# - >
# nix-shell --run '
# npm run lint;
# '
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# - when: always
check:lint:
stage: check
needs: []
script:
- >
nix-shell --run '
npm run lint;
'
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- when: always

# check:nix-dry:
# stage: check
# needs: []
# script:
# - nix-build -v -v --dry-run ./release.nix
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# - when: always
check:nix-dry:
stage: check
needs: []
script:
- nix-build -v -v --dry-run ./release.nix
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- when: always

# check:test:
# stage: check
# needs: []
# script:
# - >
# nix-shell --run '
# npm run build --verbose;
# npm test -- --ci;
# '
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit.xml
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# # This job will be overridden by `build:linux`
# - if: $CI_COMMIT_BRANCH == 'staging'
# when: never
# - when: always
check:test:
stage: check
needs: []
script:
- >
nix-shell --run '
npm run build --verbose;
npm test -- --ci;
'
artifacts:
when: always
reports:
junit:
- ./tmp/junit.xml
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
# This job will be overridden by `build:linux`
- if: $CI_COMMIT_BRANCH == 'staging'
when: never
- when: always

# build:linux:
# stage: build
# needs:
# - check:lint
# script:
# - >
# nix-shell --run '
# npm run build --verbose;
# npm test -- --ci;
# '
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit.xml
# paths:
# - ./prebuilds/
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# - if: $CI_COMMIT_BRANCH == 'staging'
build:linux:
stage: build
needs:
- check:lint
script:
- >
nix-shell --run '
npm run build --verbose;
npm test -- --ci;
'
artifacts:
when: always
reports:
junit:
- ./tmp/junit.xml
paths:
- ./prebuilds/
# Only the build:linux preserves the dist
- ./dist
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'

# build:windows:
# stage: build
# needs:
# - check:lint
# tags:
# - windows
# before_script:
# - choco install nodejs --version=16.14.2 -y
# - choco install python --version=3.9.12 -y
# - refreshenv
# script:
# - npm config set msvs_version 2019
# - npm install --ignore-scripts
# - $env:Path = "$(npm bin);" + $env:Path
# - npm run build --verbose
# - npm test -- --ci
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit.xml
# paths:
# - ./prebuilds/
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# - if: $CI_COMMIT_BRANCH == 'staging'
build:windows:
stage: build
needs:
- check:lint
tags:
- windows
before_script:
- choco install nodejs --version=16.14.2 -y
- choco install python --version=3.9.12 -y
- refreshenv
script:
- npm config set msvs_version 2019
- npm install --ignore-scripts
- $env:Path = "$(npm bin);" + $env:Path
- npm run build --verbose
- npm test -- --ci
artifacts:
when: always
reports:
junit:
- ./tmp/junit.xml
paths:
- ./prebuilds/
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'

# build:macos:
# stage: build
# needs:
# - check:lint
# tags:
# - shared-macos-amd64
# image: macos-11-xcode-12
# variables:
# HOMEBREW_NO_INSTALL_UPGRADE: "true"
# HOMEBREW_NO_INSTALL_CLEANUP: "true"
# before_script:
# - brew install node@16
# - brew link --overwrite node@16
# - brew install [email protected]
# - brew link --overwrite [email protected]
# - hash -r
# script:
# - npm install --ignore-scripts
# - export PATH="$(npm bin):$PATH"
# - export PREBUILD_ARCH=x64+arm64
# - npm run build --verbose
# - npm test -- --ci
# artifacts:
# when: always
# reports:
# junit:
# - ./tmp/junit.xml
# paths:
# - ./prebuilds/
# rules:
# - if: $CI_COMMIT_TAG
# when: manual
# - if: $CI_COMMIT_BRANCH == 'master'
# when: manual
# - if: $CI_COMMIT_BRANCH == 'staging'
build:macos:
stage: build
needs:
- check:lint
tags:
- shared-macos-amd64
image: macos-11-xcode-12
variables:
HOMEBREW_NO_INSTALL_UPGRADE: "true"
HOMEBREW_NO_INSTALL_CLEANUP: "true"
before_script:
- brew install node@16
- brew link --overwrite node@16
- brew install [email protected]
- brew link --overwrite [email protected]
- hash -r
script:
- npm install --ignore-scripts
- export PATH="$(npm bin):$PATH"
- export PREBUILD_ARCH=x64+arm64
- npm run build --verbose
- npm test -- --ci
artifacts:
when: always
reports:
junit:
- ./tmp/junit.xml
paths:
- ./prebuilds/
rules:
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
- if: $CI_COMMIT_BRANCH == 'staging'

build:prerelease:
stage: build
needs: []
# needs:
# - build:linux
# - build:windows
# - build:macos
# Needing the build jobs to complete means this only runs as part of staging
needs:
- build:linux
- build:windows
- build:macos
variables:
npm_config_auth: "$NPM_TOKEN"
script:
- echo $CI_COMMIT_BRANCH
- echo $CI_COMMIT_TAG
- echo $CI_COMMIT_REF_NAME
- echo $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME
- echo $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
- echo $CI_EXTERNAL_PULL_REQUEST_IID
- echo $CI_PIPELINE_SOURCE
- echo $CI_DEFAULT_BRANCH
# script:
# - >
# nix-shell --run '
# npm publish --tag $CI_COMMIT_BRANCH --access public;
# '
# we could use changes on package.json as well but that seems unnecessary
- >
nix-shell --run '
npm publish --tag staging --access public;
'
rules:
# we only want to allow this... if this tag is pushed in
# and the tag can only be pushed due to a pre-release tag
# generally say this is a prerelease-tag, not prerelease-* or release-*
# but after the builds work, we want to push up to npm
# but we cannot unless we create a change to package.json
# now it will bump up the version... but then the next time it runs the same occurs
# the tag is only created for staging
# note that CI_COMMIT_BRANCH doesn't actually exist in tag pipelines
# so if i push up a tag this won't make any sense
- if: $CI_COMMIT_TAG =~ /^v.+/
# Only run this for version tags that have pre-release
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.+/ && $CI_COMMIT_REF_PROTECTED == "true"
- when: never

# could we do this based ona a COMMIT on the staging branch
# one that which has a tag?

# integration:builds:
# stage: integration
Expand Down

0 comments on commit 3bac1b4

Please sign in to comment.