Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add musl based build #34

Merged
merged 10 commits into from Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 44 additions & 0 deletions .azure/azure-linux-musl.yml
@@ -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
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
@@ -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
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