<commit_before># This is a simple Azure configuration, which is intended for use
# on applications which do not require cross-platform and
# multiple-GHC-version support. For more information and other
# options, see:
#
# https://docs.haskellstack.org/en/stable/azure_ci/

trigger:
  branches:
    include:
      - master
  tags:
    include:
      - v*

variables:
  System.Debug: true
  GHC_VERSION: "8.10.1"
  CABAL_VERSION: "3.0.0.0"

pool:
  vmImage: ubuntu-18.04

jobs:
- job: build_windows
  pool:
    vmImage: windows-2019

  timeoutInMinutes: 120

  variables:
    CABAL_DIR: ""
    CABAL_STORE_DIR: "C:\\sd"

  steps:

  - checkout: self
    submodules: true

  - bash: |
      choco install -y msys2
    displayName: Install MSYS2

  - bash: |
      choco install -y ghc --version=$(GHC_VERSION)
    displayName: Install GHC

  - bash: |
      choco install -y cabal
    displayName: Install cabal

  - bash: |
      export PATH=`cygpath $ProgramData`/chocolatey/lib/ghc/tools/ghc-$(GHC_VERSION)/bin:$PATH
      echo $PATH
      cabal update
      cabal install -j1
    displayName: Build Futhark compiler

- job: build_linux

  timeoutInMinutes: 120

  steps:

  - checkout: self
    submodules: true

  - script: |
      set -e
      sudo apt update
      sudo apt install opencl-headers nvidia-cuda-dev nvidia-opencl-dev python-numpy
    displayName: Install OS-level dependencies

  - script: |
      set -e
      mkdir -p ~/.ghcup/bin
      curl https://gitlab.haskell.org/haskell/ghcup/raw/master/ghcup > ~/.ghcup/bin/ghcup
      chmod +x ~/.ghcup/bin/ghcup
      ~/.ghcup/bin/ghcup install $(GHC_VERSION)
      ~/.ghcup/bin/ghcup set $(GHC_VERSION)
      ~/.ghcup/bin/ghcup install-cabal
    displayName: Install GHC and cabal

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal check
      cabal update
      cabal install --only-dependencies
    displayName: Build Haskell dependencies

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      mkdir -p $HOME/.local/bin
      cabal install --installdir=$HOME/.local/bin --install-method=copy
    displayName: Build and install Futhark compiler

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal haddock
    displayName: Build docs

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal test
    displayName: Run unit tests

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=opencl --exclude=no_opencl tests examples
    displayName: Compile tests with backend=opencl

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=cuda --exclude=no_opencl tests examples
    displayName: Compile tests with backend=cuda

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -c --no-terminal --no-tuning --backend=python --exclude=no_python tests examples
    displayName: Compile tests and run with backend=python


  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=opencl --exclude=no_opencl futhark-benchmarks
    displayName: Compile benchmarks with backend=opencl

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      (cd libtests/c; make)
    displayName: Run library tests

- job: build_linux_nightly

  condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')

  steps:

  - checkout: self
    submodules: false

  - script: |
      curl -L --proto '=https' --tlsv1.2 https://nixos.org/nix/install | sh
      . $HOME/.nix-profile/etc/profile.d/nix.sh
      commit=$(git describe --tags --long)
      nix-build --argstr suffix nightly-linux-x86_64 --argstr commit $commit

  - task: CopyFilesOverSSH@0
    inputs:
      sshEndpoint: 'futhark-lang.org'
      sourceFolder: 'result'
      contents: 'futhark-nightly-linux-x86_64.tar.xz'
      targetFolder: '/var/www/htdocs/futhark-lang.org/releases'

- job: release_linux

  condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')

  steps:

  - checkout: self
    submodules: false

  - script: |
      export githubTag=$(git describe --abbrev=0 --tags)
      export version=$(echo $githubTag | cut -c 2-)
      echo tag: $githubTag
      echo version: $version
      echo "##vso[task.setvariable variable=githubTag]$githubTag"
      echo "##vso[task.setvariable variable=version]$version"
    displayName: Set tag to env variable githubTag and version
    failOnStderr: true

  - script: |
      curl -L --proto '=https' --tlsv1.2 https://nixos.org/nix/install | sh
      . $HOME/.nix-profile/etc/profile.d/nix.sh
      commit=$(git describe --tags --long)
      nix-build --argstr suffix $(version)-linux-x86_64 --argstr commit $commit

  - task: CopyFilesOverSSH@0
    inputs:
      sshEndpoint: 'futhark-lang.org'
      sourceFolder: 'result'
      contents: 'futhark-$(version)-linux-x86_64.tar.xz'
      targetFolder: '/var/www/htdocs/futhark-lang.org/releases'

  - task: GithubRelease@0
    displayName: 'Attach Linux x86_64 tarball to GitHub Release'
    inputs:
      gitHubConnection: 'release'
      repositoryName: 'diku-dk/futhark'
      action: 'edit'
      tagSource: 'Git tag'
      tag: '$(githubTag)'
      assets: 'result/futhark-$(version)-linux-x86_64.tar.xz'
      assetUploadMode: 'replace'
      addChangeLog: false
<commit_msg>Experiment to see if we can fix failing windows build on azure pipeline (#935)<commit_after># This is a simple Azure configuration, which is intended for use
# on applications which do not require cross-platform and
# multiple-GHC-version support. For more information and other
# options, see:
#
# https://docs.haskellstack.org/en/stable/azure_ci/

trigger:
  branches:
    include:
      - master
  tags:
    include:
      - v*

variables:
  System.Debug: true
  GHC_VERSION: "8.8.2"

pool:
  vmImage: ubuntu-18.04

jobs:
- job: build_windows
  pool:
    vmImage: windows-2019

  timeoutInMinutes: 120

  steps:

  - checkout: self
    submodules: true

  - bash: |
      choco install -y msys2
    displayName: Install MSYS2

  - bash: |
      choco install -y ghc --version=$(GHC_VERSION)
    displayName: Install GHC

  - task: Cache@2
    inputs:
      key: 'cabal | "$(Agent.OS)" | azure-pipelines.yml | "$(GHC_VERSION)" | futhark.cabal'
      restoreKeys: |
        cabal | "$(Agent.OS)"
      path: "$(APPDATA)\\cabal"
    displayName: Cache cabal packages

  - bash: |
      export PATH=`cygpath $ProgramData`/chocolatey/lib/ghc/tools/ghc-$(GHC_VERSION)/bin:$PATH
      cabal update
    displayName: Install cabal dependencies

  - bash: |
      export PATH=`cygpath $ProgramData`/chocolatey/lib/ghc/tools/ghc-$(GHC_VERSION)/bin:$PATH
      cabal install -j1 --install-method=copy --overwrite-policy=always
    displayName: Build Futhark compiler

- job: build_linux

  timeoutInMinutes: 120

  steps:

  - checkout: self
    submodules: true

  - script: |
      set -e
      sudo apt update
      sudo apt install opencl-headers nvidia-cuda-dev nvidia-opencl-dev python-numpy
    displayName: Install OS-level dependencies

  - script: |
      set -e
      mkdir -p ~/.ghcup/bin
      curl https://gitlab.haskell.org/haskell/ghcup/raw/master/ghcup > ~/.ghcup/bin/ghcup
      chmod +x ~/.ghcup/bin/ghcup
      ~/.ghcup/bin/ghcup install $(GHC_VERSION)
      ~/.ghcup/bin/ghcup set $(GHC_VERSION)
      ~/.ghcup/bin/ghcup install-cabal
    displayName: Install GHC and cabal

  - task: Cache@2
    inputs:
      key: 'cabal | "$(Agent.OS)" | azure-pipelines.yml | "$(GHC_VERSION)" | futhark.cabal'
      restoreKeys: |
        cabal | "$(Agent.OS)"
      path: "/home/vsts/.cabal"
    displayName: Cache cabal packages

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal check
      cabal update
      cabal install --only-dependencies
    displayName: Build Haskell dependencies

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      mkdir -p $HOME/.local/bin
      cabal install --installdir=$HOME/.local/bin --install-method=copy
    displayName: Build and install Futhark compiler

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal haddock
    displayName: Build docs

  - script: |
      set -e
      export PATH=$HOME/.ghcup/bin:$PATH
      cabal test
    displayName: Run unit tests

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=opencl --exclude=no_opencl tests examples
    displayName: Compile tests with backend=opencl

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=cuda --exclude=no_opencl tests examples
    displayName: Compile tests with backend=cuda

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -c --no-terminal --no-tuning --backend=python --exclude=no_python tests examples
    displayName: Compile tests and run with backend=python


  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      futhark test -C --no-terminal --backend=opencl --exclude=no_opencl futhark-benchmarks
    displayName: Compile benchmarks with backend=opencl

  - script: |
      set -e
      export PATH=$HOME/.local/bin:$PATH
      (cd libtests/c; make)
    displayName: Run library tests

- job: build_linux_nightly

  condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')

  steps:

  - checkout: self
    submodules: false

  - script: |
      curl -L --proto '=https' --tlsv1.2 https://nixos.org/nix/install | sh
      . $HOME/.nix-profile/etc/profile.d/nix.sh
      commit=$(git describe --tags --long)
      nix-build --argstr suffix nightly-linux-x86_64 --argstr commit $commit

  - task: CopyFilesOverSSH@0
    inputs:
      sshEndpoint: 'futhark-lang.org'
      sourceFolder: 'result'
      contents: 'futhark-nightly-linux-x86_64.tar.xz'
      targetFolder: '/var/www/htdocs/futhark-lang.org/releases'

- job: release_linux

  condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')

  steps:

  - checkout: self
    submodules: false

  - script: |
      export githubTag=$(git describe --abbrev=0 --tags)
      export version=$(echo $githubTag | cut -c 2-)
      echo tag: $githubTag
      echo version: $version
      echo "##vso[task.setvariable variable=githubTag]$githubTag"
      echo "##vso[task.setvariable variable=version]$version"
    displayName: Set tag to env variable githubTag and version
    failOnStderr: true

  - script: |
      curl -L --proto '=https' --tlsv1.2 https://nixos.org/nix/install | sh
      . $HOME/.nix-profile/etc/profile.d/nix.sh
      commit=$(git describe --tags --long)
      nix-build --argstr suffix $(version)-linux-x86_64 --argstr commit $commit

  - task: CopyFilesOverSSH@0
    inputs:
      sshEndpoint: 'futhark-lang.org'
      sourceFolder: 'result'
      contents: 'futhark-$(version)-linux-x86_64.tar.xz'
      targetFolder: '/var/www/htdocs/futhark-lang.org/releases'

  - task: GithubRelease@0
    displayName: 'Attach Linux x86_64 tarball to GitHub Release'
    inputs:
      gitHubConnection: 'release'
      repositoryName: 'diku-dk/futhark'
      action: 'edit'
      tagSource: 'Git tag'
      tag: '$(githubTag)'
      assets: 'result/futhark-$(version)-linux-x86_64.tar.xz'
      assetUploadMode: 'replace'
      addChangeLog: false

{'fraction_non_alphanumeric': 0.12136558107046189, 'fraction_numerical': 0.01012835065048459, 'mean_word_length': 2.58273381294964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5857790', 'n_tokens_mistral': 4028, 'n_tokens_neox': 3749, 'n_words': 925}