mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-23 03:21:51 +03:00
Co-authored-by: Franz Guzmán <fguzman@stackbuilders.com>
This commit is contained in:
parent
f3fbe9a34c
commit
51c2f9b550
@ -1 +1,10 @@
|
|||||||
|
*.nix
|
||||||
|
.github/
|
||||||
|
.tool-versions
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
cabal.project.*
|
||||||
|
dist-newstyle/
|
||||||
|
example/
|
||||||
|
fixtures/
|
||||||
|
script/
|
||||||
|
stack.yaml*
|
||||||
|
69
.github/workflows/build-and-test.yml
vendored
69
.github/workflows/build-and-test.yml
vendored
@ -1,69 +0,0 @@
|
|||||||
name: Build and Test
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
jobs:
|
|
||||||
build-and-test:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
ghc: ["8.6.5", "8.8.4", "8.10.4", "9.0.1"]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
include:
|
|
||||||
- os: macos-latest
|
|
||||||
ghc: "9.0.1"
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Install Zsh
|
|
||||||
run: |
|
|
||||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install zsh
|
|
||||||
else
|
|
||||||
brew update
|
|
||||||
brew install zsh
|
|
||||||
fi
|
|
||||||
- uses: haskell/actions/setup@v1
|
|
||||||
id: setup-haskell-cabal
|
|
||||||
with:
|
|
||||||
ghc-version: ${{ matrix.ghc }}
|
|
||||||
cabal-version: "3.4"
|
|
||||||
- run: cabal update
|
|
||||||
- run: cabal freeze --enable-tests
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
|
|
||||||
dist-newstyle
|
|
||||||
key: dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
|
|
||||||
restore-keys: |
|
|
||||||
dependencies-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
|
|
||||||
dependencies-${{ runner.os }}-${{ matrix.ghc }}-
|
|
||||||
- name: Compile dependencies
|
|
||||||
run: cabal build --only-dependencies
|
|
||||||
- name: Compile project
|
|
||||||
run: cabal build --enable-tests
|
|
||||||
- run: cabal test --enable-tests
|
|
||||||
- name: Generate module documentation with Haddock
|
|
||||||
run: |
|
|
||||||
# Fixes issue with different haddock coverage with different ghc versions https://github.com/haskell/haddock/issues/123
|
|
||||||
cabal haddock | grep "100%" | wc -l | grep -E "[4-9]|[1-9][0-9]+" ||
|
|
||||||
(echo "Haddock failed with exit code 1. Have you checked that the minimum of 4 modules with 100% documentation is fulfilled?" && false)
|
|
||||||
- run: cabal sdist
|
|
||||||
- if: matrix.ghc == '8.8.4'
|
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- if: matrix.ghc == '8.8.4'
|
|
||||||
name: Dockerize
|
|
||||||
run: |
|
|
||||||
docker build . -t hapistrano
|
|
||||||
docker run --rm hapistrano --version
|
|
84
.github/workflows/ci.yml
vendored
Normal file
84
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
---
|
||||||
|
# The present workflow was made based on the following references:
|
||||||
|
# - https://github.com/actions/cache/blob/main/examples.md#haskell---cabal
|
||||||
|
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md
|
||||||
|
# - https://github.com/haskell/time/blob/master/.github/workflows/ci.yml
|
||||||
|
# - https://github.com/stackbuilders/stache/blob/master/.github/workflows/ci.yaml
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
ghc:
|
||||||
|
- "9.0.1"
|
||||||
|
- "8.10.4"
|
||||||
|
- "8.8.4"
|
||||||
|
- "8.6.5"
|
||||||
|
include:
|
||||||
|
- os: macos-latest
|
||||||
|
ghc: "9.0.1"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: haskell/actions/setup@v1
|
||||||
|
with:
|
||||||
|
ghc-version: ${{ matrix.ghc }}
|
||||||
|
cabal-version: "3.4"
|
||||||
|
- run: |
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]
|
||||||
|
then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install zsh
|
||||||
|
else
|
||||||
|
brew update
|
||||||
|
brew install zsh
|
||||||
|
fi
|
||||||
|
- run: cabal update
|
||||||
|
- run: cabal configure --enable-tests
|
||||||
|
- run: cabal freeze
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
key: v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
|
||||||
|
restore-keys: v1-${{ runner.os }}-${{ matrix.ghc }}-
|
||||||
|
path: |
|
||||||
|
~/.cabal/packages
|
||||||
|
~/.cabal/store
|
||||||
|
dist-newstyle
|
||||||
|
- run: cabal build --only-dependencies
|
||||||
|
- run: cabal build
|
||||||
|
- run: cabal test
|
||||||
|
- run: |
|
||||||
|
# Fixes issue with different haddock coverage with different ghc versions https://github.com/haskell/haddock/issues/123
|
||||||
|
cabal haddock | grep "100%" | wc -l | grep -E "[4-9]|[1-9][0-9]+" ||
|
||||||
|
(echo "Haddock failed with exit code 1. Have you checked that the minimum of 4 modules with 100% documentation is fulfilled?" && false)
|
||||||
|
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: docker/setup-buildx-action@v1
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
key: v1-${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: v1-${{ runner.os }}-buildx-
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
- uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
load: true
|
||||||
|
tags: hapistrano:latest
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||||
|
- run: docker run hapistrano --version
|
||||||
|
- run: |
|
||||||
|
rm -rf /tmp/.buildx-cache
|
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,9 +6,12 @@ cabal-dev
|
|||||||
*.chs.h
|
*.chs.h
|
||||||
*.dyn_o
|
*.dyn_o
|
||||||
*.dyn_hi
|
*.dyn_hi
|
||||||
|
.cabal-sandbox/
|
||||||
.hpc
|
.hpc
|
||||||
.hsenv
|
.hsenv
|
||||||
.cabal-sandbox/
|
.tool-versions
|
||||||
|
cabal.project.freeze
|
||||||
|
cabal.project.local
|
||||||
cabal.sandbox.config
|
cabal.sandbox.config
|
||||||
*.prof
|
*.prof
|
||||||
*.aux
|
*.aux
|
||||||
|
89
Dockerfile
89
Dockerfile
@ -1,62 +1,33 @@
|
|||||||
# Build Hapistrano
|
FROM alpine:3.15 AS build
|
||||||
FROM alpine:3.13 as build-env
|
RUN apk update && \
|
||||||
|
apk add \
|
||||||
MAINTAINER Nicolas Vivar <nvivar@stackbuilders.com>
|
alpine-sdk \
|
||||||
|
bash \
|
||||||
RUN apk update \
|
ca-certificates \
|
||||||
&& apk add \
|
cabal \
|
||||||
alpine-sdk \
|
ghc \
|
||||||
bash \
|
ghc-dev \
|
||||||
ca-certificates \
|
git \
|
||||||
cabal \
|
gmp-dev \
|
||||||
ghc-dev \
|
gnupg \
|
||||||
ghc \
|
libffi-dev \
|
||||||
git \
|
linux-headers \
|
||||||
gmp-dev \
|
zlib-dev
|
||||||
gnupg \
|
WORKDIR /usr/src/app
|
||||||
libffi-dev \
|
|
||||||
linux-headers \
|
|
||||||
upx \
|
|
||||||
zlib-dev
|
|
||||||
|
|
||||||
WORKDIR /hapistrano
|
|
||||||
|
|
||||||
COPY hapistrano.cabal .
|
COPY hapistrano.cabal .
|
||||||
COPY src/ src/
|
RUN cabal update && \
|
||||||
COPY app/ app/
|
cabal configure -f static && \
|
||||||
COPY script/ script/
|
cabal build --only-dependencies
|
||||||
COPY LICENSE .
|
COPY . .
|
||||||
COPY Setup.hs .
|
RUN cabal install
|
||||||
# So Hapistrano is built with version information
|
|
||||||
COPY .git/ .git/
|
|
||||||
# Cabal has changed behaviour and it requires all modules listed
|
|
||||||
COPY spec/ spec/
|
|
||||||
COPY fixtures/ fixtures/
|
|
||||||
COPY CHANGELOG.md .
|
|
||||||
COPY README.md .
|
|
||||||
RUN touch Dockerfile
|
|
||||||
|
|
||||||
RUN cabal update
|
|
||||||
RUN cabal install --only-dependencies
|
|
||||||
RUN cabal configure -f static
|
|
||||||
RUN cabal build hap
|
|
||||||
|
|
||||||
# Compress the resulting binary
|
|
||||||
RUN mkdir bin
|
|
||||||
RUN cp /hapistrano/dist-newstyle/build/x86_64-linux/ghc-8.8.4/hapistrano-0.4.3.1/x/hap/build/hap/hap bin/
|
|
||||||
RUN upx /hapistrano/bin/hap
|
|
||||||
|
|
||||||
# Copy Hapistrano to a basic Alpine with SSH
|
|
||||||
FROM alpine:3.13
|
|
||||||
|
|
||||||
RUN apk update \
|
|
||||||
&& apk add \
|
|
||||||
openssh-client \
|
|
||||||
ca-certificates \
|
|
||||||
git
|
|
||||||
|
|
||||||
|
FROM alpine:3.15
|
||||||
|
MAINTAINER Nicolas Vivar <nvivar@stackbuilders.com>
|
||||||
|
RUN apk update && \
|
||||||
|
apk add \
|
||||||
|
ca-certificates \
|
||||||
|
git \
|
||||||
|
openssh-client
|
||||||
RUN mkdir ~/.ssh
|
RUN mkdir ~/.ssh
|
||||||
|
COPY --from=build /root/.cabal/bin/hap /usr/local/bin/hap
|
||||||
COPY --from=build-env /hapistrano/bin/hap /bin/hap
|
ENTRYPOINT ["/usr/local/bin/hap"]
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/hap"]
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[![Build and Test](https://github.com/stackbuilders/hapistrano/actions/workflows/build-and-test.yml/badge.svg?branch=master)](https://github.com/stackbuilders/hapistrano/actions/workflows/build-and-test.yml)
|
[![CI](https://github.com/stackbuilders/hapistrano/actions/workflows/ci.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/ci.yml)
|
||||||
[![Hackage version](https://img.shields.io/hackage/v/hapistrano.svg)](http://hackage.haskell.org/package/hapistrano)
|
[![Hackage version](https://img.shields.io/hackage/v/hapistrano.svg)](http://hackage.haskell.org/package/hapistrano)
|
||||||
[![Docker Hub](https://img.shields.io/docker/build/stackbuilders/hapistrano.svg?style=flat)](https://hub.docker.com/r/stackbuilders/hapistrano)
|
[![Docker Hub](https://img.shields.io/docker/build/stackbuilders/hapistrano.svg?style=flat)](https://hub.docker.com/r/stackbuilders/hapistrano)
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@ cabal-version: >=1.18
|
|||||||
tested-with: GHC==8.6.5, GHC==8.8.4, GHC==8.10.4, GHC==9.0.1
|
tested-with: GHC==8.6.5, GHC==8.8.4, GHC==8.10.4, GHC==9.0.1
|
||||||
extra-source-files: CHANGELOG.md
|
extra-source-files: CHANGELOG.md
|
||||||
, README.md
|
, README.md
|
||||||
, Dockerfile
|
|
||||||
data-files: script/clean-build.sh
|
|
||||||
, fixtures/*.yaml
|
|
||||||
|
|
||||||
flag dev
|
flag dev
|
||||||
description: Turn on development settings.
|
description: Turn on development settings.
|
||||||
|
Loading…
Reference in New Issue
Block a user