.gitlab-ci.yml

Summary

Maintainability
Test Coverage
before_script:
- git submodule foreach git clean -xfd
- git submodule init
- git submodule update

stages:
- build
- deploy

variables:
  PACKAGES_LINUX: >-
    flaw-al
    flaw-app
    flaw-asset
    flaw-asset-dxt
    flaw-asset-wai
    flaw-audio
    flaw-base
    flaw-build
    flaw-bullet
    flaw-canvas
    flaw-collada
    flaw-editor
    flaw-ffi
    flaw-ffmpeg
    flaw-font
    flaw-font-fhi
    flaw-font-icu
    flaw-game
    flaw-gamejolt-webapi
    flaw-gl
    flaw-gl-mesa
    flaw-gl-sdl
    flaw-graphics
    flaw-input
    flaw-itch-webapi
    flaw-lmdb
    flaw-lua
    flaw-lua-refimpl
    flaw-math
    flaw-math-determ
    flaw-network
    flaw-oil
    flaw-oil-client
    flaw-oil-server
    flaw-physics
    flaw-script
    flaw-sdl
    flaw-sl
    flaw-social
    flaw-sqlite
    flaw-steam
    flaw-steam-encryptedticket
    flaw-steam-webapi
    flaw-ui
    flaw-ui-default-style
    flaw-visual
    flaw-vulkan
    flaw-window
  # temporarily excluded:
  # flaw-websocket-server - because wai-routes dep is missing in stackage nightly
  PACKAGES_WINDOWS: >-
    flaw-al
    flaw-app
    flaw-asset
    flaw-asset-dxt
    flaw-audio
    flaw-base
    flaw-build
    flaw-bullet
    flaw-canvas
    flaw-collada
    flaw-dx11
    flaw-editor
    flaw-ffi
    flaw-font
    flaw-font-fhi
    flaw-font-icu
    flaw-game
    flaw-gl
    flaw-gl-win32
    flaw-graphics
    flaw-input
    flaw-lmdb
    flaw-lua-refimpl
    flaw-math
    flaw-math-determ
    flaw-network
    flaw-oil
    flaw-oil-client
    flaw-physics
    flaw-script
    flaw-sl
    flaw-sqlite
    flaw-steam
    flaw-ui
    flaw-ui-default-style
    flaw-visual
    flaw-vulkan
    flaw-window
  # temporarily excluded:
  # flaw-lua - crashes on building Stdlib.hs
  PACKAGES_MACOS: >-
    flaw-al
    flaw-app
    flaw-asset
    flaw-asset-dxt
    flaw-audio
    flaw-base
    flaw-build
    flaw-bullet
    flaw-canvas
    flaw-collada
    flaw-editor
    flaw-ffi
    flaw-ffmpeg
    flaw-font
    flaw-font-fhi
    flaw-font-icu
    flaw-game
    flaw-gl
    flaw-gl-sdl
    flaw-graphics
    flaw-input
    flaw-lmdb
    flaw-lua
    flaw-lua-refimpl
    flaw-math
    flaw-math-determ
    flaw-network
    flaw-oil
    flaw-oil-client
    flaw-physics
    flaw-script
    flaw-sdl
    flaw-sl
    flaw-sqlite
    flaw-steam
    flaw-ui
    flaw-ui-default-style
    flaw-visual
    flaw-window
  PACKAGES_WEB: >-
    flaw-app
    flaw-asset
    flaw-audio
    flaw-base
    flaw-build
    flaw-canvas
    flaw-ffi
    flaw-game
    flaw-gl
    flaw-graphics
    flaw-input
    flaw-js
    flaw-math
    flaw-network
    flaw-physics
    flaw-sl
    flaw-social
    flaw-websocket-client
    flaw-window

linux:
  stage: build
  script:
  - "mkdir -p flaw-linux/bin"
  - "stack --no-terminal build --test --copy-bins --local-bin-path flaw-linux/bin --flag flaw-font-fhi:icu $PACKAGES_LINUX"
  - "stack --no-terminal build --test --flag flaw-app:vulkan --flag flaw-font-fhi:icu flaw-app"
  - "mkdir linux && cp flaw-linux/bin/model-editor linux/"
  artifacts:
    name: "flaw-linux-$CI_BUILD_ID"
    paths:
    - linux
    expire_in: 1 week
  tags:
  - haskellstack
  - linux
  - x64
  except:
  - arm
  - pages

windows:
  stage: build
  script:
  - "mkdir -p flaw-windows/bin"
  - "stack --no-terminal build --test --copy-bins --local-bin-path flaw-windows/bin $PACKAGES_WINDOWS"
  - "stack --no-terminal build --test --flag flaw-app:vulkan flaw-app"
  - "stack --no-terminal build --test --flag flaw-app:-dx11 flaw-app"
  - "stack --no-terminal build --test --flag flaw-app:-gl flaw-app"
  - "mkdir windows && cp flaw-windows/bin/model-editor.exe windows/"
  artifacts:
    name: "flaw-windows-$CI_BUILD_ID"
    paths:
    - windows
    expire_in: 1 week
  tags:
  - haskellstack
  - windows
  - x64
  except:
  - arm
  - pages

macos:
  stage: build
  script:
  - "mkdir -p flaw-macos/bin"
  - "stack --no-terminal build --test --copy-bins --local-bin-path flaw-macos/bin --flag flaw-font-fhi:icu $PACKAGES_MACOS"
  - "mkdir macos && cp flaw-macos/bin/model-editor macos/"
  artifacts:
    name: "flaw-macos-$CI_BUILD_ID"
    paths:
    - macos
    expire_in: 1 week
  tags:
  - haskellstack
  - macos
  - x64
  except:
  - arm
  - pages

.web:
  stage: build
  script:
  - "stack --no-terminal --compiler ghcjs-0.2.0_ghc-8.0.1 build --test $PACKAGES_WEB"
  tags:
  - haskellstack
  - ghcjs
  - linux
  - x64
  except:
  - arm
  - pages

itch:
  stage: deploy
  environment: itch
  dependencies:
  - linux
  - windows
  - macos
  script:
  - "butler push linux quyse/flaw:model-editor-linux"
  - "butler push windows quyse/flaw:model-editor-windows"
  - "butler push macos quyse/flaw:model-editor-macos"
  tags:
  - linux
  - x64
  - butler
  only:
  - master

pages:
  stage: deploy
  environment: pages
  dependencies: []
  script:
  - "stack --no-terminal build --test --haddock --coverage $PACKAGES_LINUX"
  - "mkdir public"
  - "hlint . --cross --no-exit-code --quiet --report=public/hlint.html"
  - "mv $(stack path --local-doc-root) public/docs"
  - "mv $(stack path --local-hpc-root) public/hpc"
  - "./pages/sanitize.sh public"
  - "tail -n +5 README.md | pandoc -f markdown_github -o public/index.html --template pages/index.html"
  tags:
  - haskellstack
  - linux
  - x64
  artifacts:
    paths:
    - public
    expire_in: 1 week
  only:
  - master
  - pages