diff --git a/.azure/linux-stack.yml b/.azure/linux-stack.yml new file mode 100644 index 00000000..a21ef8e3 --- /dev/null +++ b/.azure/linux-stack.yml @@ -0,0 +1,57 @@ +jobs: +- job: ghcide_stack_linux + timeoutInMinutes: 60 + pool: + vmImage: 'ubuntu-latest' + strategy: + matrix: + stack_88: + STACK_YAML: "stack88.yaml" + stack_86: + STACK_YAML: "stack.yaml" + stack_84: + STACK_YAML: "stack84.yaml" + stack_ghc_lib_88: + STACK_YAML: "stack-ghc-lib.yaml" + steps: + - checkout: self + - task: Cache@2 + inputs: + key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal + path: .azure-cache + cacheHitVar: CACHE_RESTORED + displayName: "Cache stack artifacts" + - bash: | + mkdir -p ~/.stack + tar xzf .azure-cache/stack-root.tar.gz -C $HOME + displayName: "Unpack cache" + condition: eq(variables.CACHE_RESTORED, 'true') + - bash: | + ./fmt.sh + displayName: "HLint via ./fmt.sh" + - bash: | + sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev + if ! which stack >/dev/null 2>&1; then + curl -sSL https://get.haskellstack.org/ | sh + fi + displayName: 'Install Stack' + - bash: stack setup --stack-yaml=$STACK_YAML + displayName: 'stack setup' + - bash: stack build --only-dependencies --stack-yaml=$STACK_YAML + displayName: 'stack build --only-dependencies' + - bash: stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML|| stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML + # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. + displayName: 'stack test --ghc-options=-Werror' + - bash: | + mkdir -p .azure-cache + tar czf .azure-cache/stack-root.tar.gz -C $HOME .stack + displayName: "Pack cache" + - bash: | + set -euo pipefail + MESSAGE=$(git log --pretty=format:%s -n1) + curl -XPOST \ + -i \ + -H 'Content-type: application/json' \ + --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ + $(Slack.URL) + condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) diff --git a/.azure/windows-stack.yml b/.azure/windows-stack.yml new file mode 100644 index 00000000..e1cc64ef --- /dev/null +++ b/.azure/windows-stack.yml @@ -0,0 +1,66 @@ +jobs: +- job: ghcide_stack_windows + timeoutInMinutes: 60 + pool: + vmImage: 'windows-2019' + strategy: + matrix: + stack_88: + STACK_YAML: "stack88.yaml" + stack_86: + STACK_YAML: "stack.yaml" + stack_84: + STACK_YAML: "stack84.yaml" + stack_ghc_lib_88: + STACK_YAML: "stack-ghc-lib.yaml" + variables: + STACK_ROOT: "C:\\sr" + steps: + - checkout: self + - task: Cache@2 + inputs: + key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal + path: .azure-cache + cacheHitVar: CACHE_RESTORED + displayName: "Cache stack artifacts" + - bash: | + mkdir -p $STACK_ROOT + tar -vxzf .azure-cache/stack-root.tar.gz -C /c + mkdir -p .stack-work + tar -vxzf .azure-cache/stack-work.tar.gz + displayName: "Unpack cache" + condition: eq(variables.CACHE_RESTORED, 'true') + - bash: | + ./fmt.sh + displayName: "HLint via ./fmt.sh" + - bash: | + curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip + unzip -o /usr/bin/stack.zip -d /usr/bin/ + mkdir -p "$STACK_ROOT" + displayName: 'Install Stack' + - bash: stack setup --stack-yaml $STACK_YAML + displayName: 'stack setup' + - bash: | + # Installing happy standalone to avoid error "strip.exe: unable to rename ../happy.exe; reason: File exists" + stack install happy --stack-yaml $STACK_YAML + stack build --only-dependencies --stack-yaml $STACK_YAML + displayName: 'stack build --only-dependencies' + - bash: stack test --ghc-options=-Werror --stack-yaml $STACK_YAML || stack test --ghc-options=-Werror --stack-yaml $STACK_YAML || stack test --ghc-options=-Werror --stack-yaml $STACK_YAML + # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. + displayName: 'stack test --ghc-options=-Werror' + # TODO: Enable when failing tests are fixed or marked as broken. See https://github.com/digital-asset/ghcide/issues/474 + condition: False + - bash: | + mkdir -p .azure-cache + tar -vczf .azure-cache/stack-root.tar.gz $(cygpath $STACK_ROOT) + tar -vczf .azure-cache/stack-work.tar.gz .stack-work + displayName: "Pack cache" + - bash: | + set -euo pipefail + MESSAGE=$(git log --pretty=format:%s -n1) + curl -XPOST \ + -i \ + -H 'Content-type: application/json' \ + --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ + $(Slack.URL) + condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) diff --git a/.gitignore b/.gitignore index e1869d9a..afecc7b9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ cabal.project.local *~ *.lock /.tasty-rerun-log +.vscode diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 765c00c8..4021f118 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,6 +4,7 @@ trigger: branches: include: - master + - azure* # Enable PR triggers that target the master branch pr: @@ -13,187 +14,5 @@ pr: - master jobs: - - job: ghcide_stack_86 - timeoutInMinutes: 60 - pool: - vmImage: 'ubuntu-latest' - steps: - - checkout: self - - task: CacheBeta@0 - inputs: - key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal - path: .azure-cache - cacheHitVar: CACHE_RESTORED - displayName: "Cache stack artifacts" - - bash: | - mkdir -p ~/.stack - tar xzf .azure-cache/stack-root.tar.gz -C $HOME - displayName: "Unpack cache" - condition: eq(variables.CACHE_RESTORED, 'true') - - bash: | - ./fmt.sh - displayName: "HLint via ./fmt.sh" - - bash: | - sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev - if ! which stack >/dev/null 2>&1; then - curl -sSL https://get.haskellstack.org/ | sh - fi - displayName: 'Install Stack' - - bash: stack setup - displayName: 'stack setup' - - bash: stack build --only-dependencies - displayName: 'stack build --only-dependencies' - - bash: stack test --ghc-options=-Werror || stack test --ghc-options=-Werror || stack test --ghc-options=-Werror - # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. - displayName: 'stack test --ghc-options=-Werror' - - bash: | - mkdir -p .azure-cache - tar czf .azure-cache/stack-root.tar.gz -C $HOME .stack - displayName: "Pack cache" - - bash: | - set -euo pipefail - MESSAGE=$(git log --pretty=format:%s -n1) - curl -XPOST \ - -i \ - -H 'Content-type: application/json' \ - --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ - $(Slack.URL) - condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) - - job: ghcide_stack_84 - timeoutInMinutes: 60 - pool: - vmImage: 'ubuntu-latest' - steps: - - checkout: self - - task: CacheBeta@0 - inputs: - key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/stack84.yaml | $(Build.SourcesDirectory)/ghcide.cabal - path: .azure-cache - cacheHitVar: CACHE_RESTORED - displayName: "Cache stack artifacts" - - bash: | - mkdir -p ~/.stack - tar xzf .azure-cache/stack-root.tar.gz -C $HOME - displayName: "Unpack cache" - condition: eq(variables.CACHE_RESTORED, 'true') - - bash: | - ./fmt.sh - displayName: "HLint via ./fmt.sh" - - bash: | - sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev - if ! which stack >/dev/null 2>&1; then - curl -sSL https://get.haskellstack.org/ | sh - fi - displayName: 'Install Stack' - - bash: stack setup --stack-yaml=stack84.yaml - displayName: 'stack setup --stack-yaml=stack84.yaml' - - bash: stack build --only-dependencies --stack-yaml=stack84.yaml - displayName: 'stack build --only-dependencies --stack-yaml=stack84.yaml' - - bash: stack test --stack-yaml=stack84.yaml --ghc-options=-Werror || stack test --stack-yaml=stack84.yaml --ghc-options=-Werror || stack test --stack-yaml=stack84.yaml --ghc-options=-Werror - # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. - displayName: 'stack test --stack-yaml=stack84.yaml --ghc-options=-Werror' - - bash: | - mkdir -p .azure-cache - tar czf .azure-cache/stack-root.tar.gz -C $HOME .stack - displayName: "Pack cache" - - bash: | - set -euo pipefail - MESSAGE=$(git log --pretty=format:%s -n1) - curl -XPOST \ - -i \ - -H 'Content-type: application/json' \ - --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ - $(Slack.URL) - condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) - - job: ghcide_stack_88 - timeoutInMinutes: 60 - pool: - vmImage: 'ubuntu-latest' - steps: - - checkout: self - - task: CacheBeta@0 - inputs: - key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/stack88.yaml | $(Build.SourcesDirectory)/ghcide.cabal - path: .azure-cache - cacheHitVar: CACHE_RESTORED - displayName: "Cache stack artifacts" - - bash: | - mkdir -p ~/.stack - tar xzf .azure-cache/stack-root.tar.gz -C $HOME - displayName: "Unpack cache" - condition: eq(variables.CACHE_RESTORED, 'true') - - bash: | - ./fmt.sh - displayName: "HLint via ./fmt.sh" - - bash: | - sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev - if ! which stack >/dev/null 2>&1; then - curl -sSL https://get.haskellstack.org/ | sh - fi - displayName: 'Install Stack' - - bash: stack setup --stack-yaml=stack88.yaml - displayName: 'stack setup --stack-yaml=stack88.yaml' - - bash: stack build --only-dependencies --stack-yaml=stack88.yaml - displayName: 'stack build --only-dependencies --stack-yaml=stack88.yaml' - - bash: stack test --stack-yaml=stack88.yaml --ghc-options=-Werror || stack test --stack-yaml=stack88.yaml --ghc-options=-Werror || stack test --stack-yaml=stack88.yaml --ghc-options=-Werror - # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. - displayName: 'stack test --stack-yaml=stack88.yaml --ghc-options=-Werror' - - bash: | - mkdir -p .azure-cache - tar czf .azure-cache/stack-root.tar.gz -C $HOME .stack - displayName: "Pack cache" - - bash: | - set -euo pipefail - MESSAGE=$(git log --pretty=format:%s -n1) - curl -XPOST \ - -i \ - -H 'Content-type: application/json' \ - --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ - $(Slack.URL) - condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) - - job: ghcide_stack_ghc_lib_88 - timeoutInMinutes: 60 - pool: - vmImage: 'ubuntu-latest' - steps: - - checkout: self - - task: CacheBeta@0 - inputs: - key: stack-cache-v2 | $(Agent.OS) | $(Build.SourcesDirectory)/stack-ghc-lib.yaml | $(Build.SourcesDirectory)/ghcide.cabal - path: .azure-cache - cacheHitVar: CACHE_RESTORED - displayName: "Cache stack artifacts" - - bash: | - mkdir -p ~/.stack - tar xzf .azure-cache/stack-root.tar.gz -C $HOME - displayName: "Unpack cache" - condition: eq(variables.CACHE_RESTORED, 'true') - - bash: | - ./fmt.sh - displayName: "HLint via ./fmt.sh" - - bash: | - sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev - if ! which stack >/dev/null 2>&1; then - curl -sSL https://get.haskellstack.org/ | sh - fi - displayName: 'Install Stack' - - bash: stack setup --stack-yaml=stack-ghc-lib.yaml - displayName: 'stack setup --stack-yaml=stack-ghc-lib.yaml' - - bash: stack build --only-dependencies --stack-yaml=stack-ghc-lib.yaml - displayName: 'stack build --only-dependencies --stack-yaml=stack-ghc-lib.yaml' - - bash: stack test --stack-yaml=stack-ghc-lib.yaml --ghc-options=-Werror || stack test --stack-yaml=stack-ghc-lib.yaml --ghc-options=-Werror || stack test --stack-yaml=stack-ghc-lib.yaml --ghc-options=-Werror - # ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606. - displayName: 'stack test --stack-yaml=stack-ghc-lib.yaml --ghc-options=-Werror' - - bash: | - mkdir -p .azure-cache - tar czf .azure-cache/stack-root.tar.gz -C $HOME .stack - displayName: "Pack cache" - - bash: | - set -euo pipefail - MESSAGE=$(git log --pretty=format:%s -n1) - curl -XPOST \ - -i \ - -H 'Content-type: application/json' \ - --data "{\"text\":\" *FAILED* $(Agent.JobName): \n\"}" \ - $(Slack.URL) - condition: and(failed(), eq(variables['Build.SourceBranchName'], 'master')) + - template: ./.azure/linux-stack.yml + - template: ./.azure/windows-stack.yml