stages:
  - test
  - build

variables:
  GIT_DEPTH: '3'
  SIMPLECOV: 'true'
  RUST_BACKTRACE: '1'
  RUSTFLAGS: ''
  CARGOFLAGS: ''

cache:
  path:
    - node_modules/
    - packages/*/node_modules/


.branches: &branches
  only:
    - beta
    - tags
    - stable
    - triggers
    - master

linux-test:
  stage: test
  image: node:8
  script:
    - curl -o- -L https://yarnpkg.com/install.sh | bash
    - export PATH=$HOME/.yarn/bin:$PATH
    - yarn install
    - yarn test
  tags:
    - linux-docker

linux-build:
  stage: build
  image: node:8
  <<: *branches
  script:
    - curl -o- -L https://yarnpkg.com/install.sh | bash
    - export PATH=$HOME/.yarn/bin:$PATH
    - yarn install
    - yarn build
    - yarn release --linux
  tags:
    - linux-docker
  artifacts:
    expire_in: 1 week
    paths:
      - 'packages/fether-electron/dist/*.AppImage'
      - 'packages/fether-electron/dist/*.tar.xz'
      - 'packages/fether-electron/dist/*.snap'
      - 'packages/fether-electron/dist/*.deb'

osx-build:
  stage: build
  <<: *branches
  script:
    - curl -o- -L https://yarnpkg.com/install.sh | bash
    - export PATH=$HOME/.yarn/bin:$PATH
    - yarn install
    - yarn build
    - yarn release --mac
  tags:
    - darwin-shell
  artifacts:
    expire_in: 1 week
    paths:
      - 'packages/fether-electron/dist/*.dmg'
      - 'packages/fether-electron/dist/*.zip'

win-build:
  stage: build
  image: electronuserland/builder:wine
  <<: *branches
  script:
    - yarn install
    - yarn build
    - yarn release --win
  tags:
    - linux-docker
  artifacts:
    expire_in: 1 week
    paths:
      - 'packages/fether-electron/dist/*.exe'
