Skip to content

Commit ad07a9b

Browse files
committed
Publish static build artifacts on azure pipelines
1 parent 526d4ff commit ad07a9b

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

azure-pipelines.yml

+58
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,83 @@ jobs:
77
- script: curl -sSL https://get.haskellstack.org/ | sh
88
displayName: Install stack
99

10+
- script: stack build --flag fake-json:-static
11+
displayName: Build
12+
1013
- script: stack test
1114
displayName: Run tests
1215

16+
- task: PublishPipelineArtifact@0
17+
inputs:
18+
artifactName: 'fake-json-linux-x86_64'
19+
targetPath: '.stack-work/install/x86_64-linux/lts-12.20/8.4.4/bin/'
20+
1321
- job: MacOSTest
1422
pool:
1523
vmImage: 'macOS-10.13'
1624
steps:
1725
- script: curl -sSL https://get.haskellstack.org/ | sh
1826
displayName: Install stack
1927

28+
- script: stack build --flag fake-json:-static
29+
displayName: Build
30+
2031
- script: stack test
2132
displayName: Run tests
2233

34+
- task: PublishPipelineArtifact@0
35+
inputs:
36+
artifactName: 'fake-json-osx-x86_64'
37+
targetPath: '.stack-work/install/x86_64-osx/lts-12.20/8.4.4/bin/'
38+
2339
- job: WindowsTest
2440
pool:
2541
vmImage: 'VS2017-Win2016'
2642
steps:
2743
- script: choco install haskell-stack
2844
displayName: Install stack
2945

46+
- script: stack build --flag fake-json:-static
47+
displayName: Build
48+
3049
- script: stack test
3150
displayName: Run tests
51+
52+
- task: PublishPipelineArtifact@0
53+
inputs:
54+
artifactName: 'fake-json-windows-x86_64'
55+
targetPath: '.stack-work\install\ad603a72\bin'
56+
57+
- job: Release
58+
dependsOn:
59+
- LinuxTest
60+
- MacOSTest
61+
- WindowsTest
62+
63+
steps:
64+
- script: mkdir -p $(System.DefaultWorkingDirectory)/artifacts/
65+
- task: DownloadPipelineArtifact@0
66+
inputs:
67+
artifactName: 'fake-json-windows-x86_64'
68+
targetPath: $(System.DefaultWorkingDirectory)/artifacts/
69+
70+
- task: DownloadPipelineArtifact@0
71+
inputs:
72+
artifactName: 'fake-json-osx-x86_64'
73+
targetPath: $(System.DefaultWorkingDirectory)/artifacts/
74+
- script: mv $(System.DefaultWorkingDirectory)/artifacts/fake-json{,-osx-x86_64}
75+
76+
- task: DownloadPipelineArtifact@0
77+
inputs:
78+
artifactName: 'fake-json-linux-x86_64'
79+
targetPath: $(System.DefaultWorkingDirectory)/artifacts/
80+
- script: mv $(System.DefaultWorkingDirectory)/artifacts/fake-json{,-linux-x86_64}
81+
82+
- task: GithubRelease@0
83+
inputs:
84+
gitHubConnection: 'GitHub connection'
85+
repositoryName: mfussenegger/fake-json
86+
target: '$(build.sourceVersion)'
87+
assets: $(System.DefaultWorkingDirectory)/artifacts/*
88+
tagSource: 'auto'
89+
isDraft: true

package.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ executables:
4949
- -rtsopts
5050
dependencies:
5151
- fake-json
52+
when:
53+
- condition: flag(static)
54+
ld-options:
55+
- -static
56+
ghc-options:
57+
- fPIC
5258

5359
tests:
5460
fake-json-test:
@@ -67,3 +73,9 @@ tests:
6773
- fake-json
6874
- Glob
6975
- doctest
76+
77+
flags:
78+
static:
79+
description: Pass -static to ghc when linking the binary.
80+
manual: true
81+
default: false

0 commit comments

Comments
 (0)