Skip to content

Commit

Permalink
Publish static build artifacts on azure pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Dec 19, 2018
1 parent 526d4ff commit ad07a9b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
58 changes: 58 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,83 @@ jobs:
- script: curl -sSL https://get.haskellstack.org/ | sh
displayName: Install stack

- script: stack build --flag fake-json:-static
displayName: Build

- script: stack test
displayName: Run tests

- task: PublishPipelineArtifact@0
inputs:
artifactName: 'fake-json-linux-x86_64'
targetPath: '.stack-work/install/x86_64-linux/lts-12.20/8.4.4/bin/'

- job: MacOSTest
pool:
vmImage: 'macOS-10.13'
steps:
- script: curl -sSL https://get.haskellstack.org/ | sh
displayName: Install stack

- script: stack build --flag fake-json:-static
displayName: Build

- script: stack test
displayName: Run tests

- task: PublishPipelineArtifact@0
inputs:
artifactName: 'fake-json-osx-x86_64'
targetPath: '.stack-work/install/x86_64-osx/lts-12.20/8.4.4/bin/'

- job: WindowsTest
pool:
vmImage: 'VS2017-Win2016'
steps:
- script: choco install haskell-stack
displayName: Install stack

- script: stack build --flag fake-json:-static
displayName: Build

- script: stack test
displayName: Run tests

- task: PublishPipelineArtifact@0
inputs:
artifactName: 'fake-json-windows-x86_64'
targetPath: '.stack-work\install\ad603a72\bin'

- job: Release
dependsOn:
- LinuxTest
- MacOSTest
- WindowsTest

steps:
- script: mkdir -p $(System.DefaultWorkingDirectory)/artifacts/
- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'fake-json-windows-x86_64'
targetPath: $(System.DefaultWorkingDirectory)/artifacts/

- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'fake-json-osx-x86_64'
targetPath: $(System.DefaultWorkingDirectory)/artifacts/
- script: mv $(System.DefaultWorkingDirectory)/artifacts/fake-json{,-osx-x86_64}

- task: DownloadPipelineArtifact@0
inputs:
artifactName: 'fake-json-linux-x86_64'
targetPath: $(System.DefaultWorkingDirectory)/artifacts/
- script: mv $(System.DefaultWorkingDirectory)/artifacts/fake-json{,-linux-x86_64}

- task: GithubRelease@0
inputs:
gitHubConnection: 'GitHub connection'
repositoryName: mfussenegger/fake-json
target: '$(build.sourceVersion)'
assets: $(System.DefaultWorkingDirectory)/artifacts/*
tagSource: 'auto'
isDraft: true
12 changes: 12 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ executables:
- -rtsopts
dependencies:
- fake-json
when:
- condition: flag(static)
ld-options:
- -static
ghc-options:
- fPIC

tests:
fake-json-test:
Expand All @@ -67,3 +73,9 @@ tests:
- fake-json
- Glob
- doctest

flags:
static:
description: Pass -static to ghc when linking the binary.
manual: true
default: false

0 comments on commit ad07a9b

Please sign in to comment.