Skip to content

Commit

Permalink
Add musl based build (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
psibi authored Dec 2, 2020
1 parent bd45987 commit 5469ecb
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 41 deletions.
44 changes: 44 additions & 0 deletions .azure/azure-linux-musl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: 120
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
musl:
BUILD: musl
maxParallel: 5
steps:
- bash: echo "##vso[task.setvariable variable=TAG]${BUILD_SOURCEBRANCH##refs/tags/}"
displayName: Set TAG variable
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
- script: |
docker image build . -t tldr
# https://github.com/moby/moby/issues/34592#issuecomment-331001595
CID=$(docker create tldr)
docker cp ${CID}:/app/tldr .
docker rm ${CID}
echo "musl build"
ls
ls -lh ./tldr
cp ./tldr $(Build.ArtifactStagingDirectory)
env:
OS_NAME: ${{ parameters.os }}
displayName: 'Installation ${{parameters.os}} & Test'
- task: ArchiveFiles@2
inputs:
includeRootFolder: false
archiveType: tar
tarCompression: gz
archiveFile: $(Build.ArtifactStagingDirectory)/tldr-musl-linux-$(TAG).tar.gz
verbose: true
condition: and(startsWith(variables['TAG'], 'v'), eq(variables['DEPLOY'], '1'))
- task: GithubRelease@0
displayName: Create GitHub Release
inputs:
githubConnection: github.com_psibi
assets: $(Build.ArtifactStagingDirectory)/tldr-linux-$(TAG).tar.gz
assetUploadMode: replace
action: edit
tag: $(TAG)
condition: and(startsWith(variables['TAG'], 'v'), eq(variables['DEPLOY'], '1'))
41 changes: 0 additions & 41 deletions .azure/azure-linux-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,6 @@ jobs:
mv "$PACKAGE-$VERSION" "$PACKAGE"
export PATH="$(pwd)"/hlint:$PATH
;;
cabal)
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
# See note here: https://github.com/haskell-CI/haskell-ci#alex--happy-with-ghc--78
if [ "$GHCVER" = "head" ] || [ "${GHCVER%.*}" = "7.8" ] || [ "${GHCVER%.*}" = "7.10" ]; then
sudo apt-get install happy-1.19.4 alex-3.1.3
export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH
else
sudo apt-get install happy alex
fi
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
cabal --version
cabal update
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
;;
*)
export PATH=$HOME/.local/bin:$PATH
stack --install-ghc $ARGS test --bench --only-dependencies
Expand All @@ -67,30 +50,6 @@ jobs:
style)
hlint src/
;;
cabal)
cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
ORIGDIR=$(pwd)
for dir in $PACKAGES
do
cd $dir
cabal check || [ "$CABALVER" == "1.16" ]
cabal sdist
PKGVER=$(cabal info . | awk '{print $2;exit}')
SRC_TGZ=$PKGVER.tar.gz
cd dist
tar zxfv "$SRC_TGZ"
cd "$PKGVER"
cabal configure --enable-tests --ghc-options -O0
cabal build
if [ "$CABALVER" = "1.16" ] || [ "$CABALVER" = "1.18" ]; then
cabal test
else
cabal test --show-details=streaming
fi
cd $ORIGDIR
done
;;
*)
stack $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
;;
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM fpco/alpine-haskell-stack:8.6.5

COPY . /app

RUN cd /app

RUN env STACK_YAML=/app/stack.yaml stack --system-ghc install --local-bin-path /app --flag tldr:static
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ trigger:
- '*'

jobs:
- template: ./.azure/azure-linux-musl.yml
parameters:
name: Linux
vmImage: ubuntu-latest
os: linux

- template: ./.azure/azure-linux-template.yml
parameters:
name: Linux
Expand Down

0 comments on commit 5469ecb

Please sign in to comment.