Skip to content
.gitlab-ci.yml 2.71 KiB
Newer Older
stages:
  - build
  - package

image:                  parity/rust:gitlab-ci

cache:
  key:                  "${CI_JOB_NAME}"
  paths:
    - ${CI_PROJECT_DIR}/target/
    - ${CI_PROJECT_DIR}/cargo/
    - node_modules/
    - .cache
    - $HOME/.cache

.releaseable_branches:  # list of git refs for building GitLab artifacts (think "pre-release binaries")
  only:                 &releaseable_branches
Amaury Martiny's avatar
Amaury Martiny committed
    - schedules # Our nightly builds from schedule, on `master`
    - "v*" # Our version tags
    - ci-package
    - next
    - tags

.publishable_branches:  # list of git refs for publishing builds to the "production" locations
  only:                 &publishable_branches
    - schedules # Our nightly builds from schedule, on `master`
    - "v*" # Our version tags

before_script:
  - npm install --global yarn --cache-min 999999999
  - npm install
  - export VERSION=$(node -p "require('./package.json').version")
Amaury Martiny's avatar
Amaury Martiny committed
# Stage - build
build:
  stage:                build
  script:
    - scripts/lint.sh
Amaury Martiny's avatar
Amaury Martiny committed
    # - scripts/test.sh
    - scripts/build.sh
Amaury Martiny's avatar
Amaury Martiny committed
    - scripts/push-precompiled.sh # TODO This needs to be done only on master branch!
  tags:
    - rust-stable

# Stage package binaries
package:binaries:linux:
  stage:                package
  only:                 *releaseable_branches
  script:
    - npm run release
  artifacts:
    name:               "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    when:               on_success
    expire_in:          1 week
    paths:
      - dist/*.deb
      - dist/*.snap
      - dist/*.AppImage
      - dist/*.xz
  tags:
    - rust-stable
package:binaries:mac:
  stage:                package
  only:                 *releaseable_branches
  script:
    - export ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
    - npm run release -- --mac
  artifacts:
    name:               "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    when:               on_success
    expire_in:          1 week
    paths:
      - dist/*.pkg
  tags:
    - osx
package:binaries:windows:
  stage:                package
  only:                 *releaseable_branches
  image:                electronuserland/builder:wine
  script:
    - npm run release -- --win
  artifacts:
    name:               "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    when:               on_success
    expire_in:          1 week
    paths:
      - dist/*.exe
  tags:
    - rust-stable
Amaury Martiny's avatar
Amaury Martiny committed
# Stage publish
Amaury Martiny's avatar
Amaury Martiny committed
  stage:                publish
  only:                 *publishable_branches
  image:                snapcore/snapcraft:stable
  dependencies:
    - package:binaries:linux
  variables:
    BUILD_ARCH: amd64
  before_script:
Amaury Martiny's avatar
Amaury Martiny committed
    - export VERSION=$(node -p "require('./package.json').version")
  script:
    - scripts/publish-snap.sh
  tags:
    - rust-stable