Skip to content

Commit

Permalink
add a HTTP service template based on servant and Chakra.
Browse files Browse the repository at this point in the history
  • Loading branch information
hughjfchen committed Jan 30, 2023
1 parent 6d4a6d1 commit e394a35
Show file tree
Hide file tree
Showing 110 changed files with 8,145 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
((nil . ((lsp-haskell-server-path . "haskell-language-server")
(lsp-haskell-formatting-provider . "fourmolu"))))
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = false
charset = utf-8
indent_style = space
indent_size = 2

[Makefile]
indent_size = 4
indent_style = tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
APP_ENVIRONMENT=Development
PORT=3000
APP_NAME="{{name|toTitle}}"
APP_DESCRIPTION="{{description}}"
APP_VERSION="0.0.1.0"
JWK_PATH="secrets/jwk.sig"
JWK_AUDIENCES="api://63179623-ffda-483e-a7c9-638ebe33726d"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:set -Wall
:set -Wcompat
:set -Widentities
:set -Wincomplete-uni-patterns
:set -Wincomplete-record-updates
:set -Wredundant-constraints
:set -Wnoncanonical-monad-instances
:set -fhide-source-paths
:set -Wmissing-export-lists
:set -Wpartial-fields
:set -Wmissing-deriving-strategies
:set -Wunused-packages
:set -XConstraintKinds
:set -XDeriveAnyClass
:set -XDeriveFunctor
:set -XDeriveDataTypeable
:set -XDeriveGeneric
:set -XDerivingStrategies
:set -XFlexibleContexts
:set -XFlexibleInstances
:set -XGeneralizedNewtypeDeriving
:set -XTemplateHaskell
:set -XInstanceSigs
:set -XKindSignatures
:set -XLambdaCase
:set -XMultiParamTypeClasses
:set -XOverloadedStrings
:set -XRecordWildCards
:set -XScopedTypeVariables
:set -XStandaloneDeriving
:set -XTupleSections
:set -XTypeApplications
:set -XViewPatterns
:set -XPatternSynonyms
:def hg \x -> return $ ":!hoogle \"" ++ x ++ "\""
:def hgi \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--command="cabal new-repl lib:haskell-web-api-template" --test=":!cabal new-test haskell-web-api-template:test:haskell-web-api-template-test"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Cachix-CI"
on:
pull_request:
push:
branches: [master]

jobs:
cachix-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-{{ nixos_release }}
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://hydra.iohk.io https://cache.nixos.org/
- run: nix-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: haskell-ci

# Trigger the workflow on push or pull request, but only for the main branch
on:
pull_request:
push:
branches: [master]

jobs:
cabal:
name: {% raw %} ${{ matrix.os }} / ghc ${{ matrix.ghc }} {% endraw %}
runs-on: {% raw %} ${{ matrix.os }} {% endraw %}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
cabal: ["3.6"]
ghc:
- {{ghc_version}}
exclude:
- os: macOS-latest
ghc: 8.8.4
- os: windows-latest
ghc: 8.8.4

steps:
- uses: actions/checkout@v2.3.3
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: {% raw %} ${{ matrix.ghc }} {% endraw %}
cabal-version: {% raw %} ${{ matrix.cabal }} {% endraw %}

- name: Freeze
run: |
cabal v2-freeze
- uses: actions/cache@v2.1.2
name: Cache ~/.cabal/store
with:
path: {% raw %} ${{ steps.setup-haskell-cabal.outputs.cabal-store }} {% endraw %}
key: {% raw %} ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} {% endraw %}

- name: Build
run: |
cabal v2-configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal v2-build all
- name: Test
run: |
cabal v2-test all
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: nix-ci

# Trigger the workflow on push or pull request, but only for the main branch
on:
pull_request:
push:
# comment out the branches, only build tags for release to reduce the free github action minus
# branches: [master]
tags:
- "v*.*.*.*"
- "M*"

jobs:
nix-ci:
name: {% raw %} ${{ matrix.os }} / ghc ${{ matrix.ghc }} {% endraw %}
runs-on: {% raw %} ${{ matrix.os }} {% endraw %}
strategy:
matrix:
os: [ubuntu-latest]
ghc:
- {{ ghc_version }}
exclude:
- os: macOS-latest
ghc: 8.8.4
- os: windows-latest
ghc: 8.8.4

steps:
- name: checkout source
uses: actions/checkout@v2.3.3
if: github.event.action == 'opened' || github.event.action == 'synchronize' || startsWith(github.ref, 'refs/tags/')

- name: adjust nix store path permission for restore
run: |
# Create with liberal rights, otherwise cache action will complain
# about permission errors.
sudo mkdir -p /nix/store
sudo chmod -R 777 /nix
- name: Cache nix env take N+1
uses: actions/cache@v2
with:
path: |
# See https://github.com/actions/cache/pull/726
/nix/store/**
# Missing something?
/nix/var/nix/*/*
/nix/var/nix/db/*
/nix/var/nix/db/*/**
!/nix/var/nix/daemon-socket/socket
!/nix/var/nix/userpool/*
!/nix/var/nix/gc.lock
!/nix/var/nix/db/big-lock
!/nix/var/nix/db/reserved
key: {{ name }}-nixos-{{nixos_release | remove(".")}}-ghc{{ghc_version | remove(".")}}-cache

- name: install Nix quickly with iohk cache
uses: nixbuild/nix-quick-install-action@v10
with:
nix_conf: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://hydra.iohk.io https://cache.nixos.org/
- name: build the cross platform target(s) for release
run: nix-build ./cross-build.nix -A x86-musl64.{{name}}.{{name}}-exe
if: startsWith(github.ref, 'refs/tags/')

- name: release to github if a tag pushed
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
CHANGELOG.md
result/bin/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: self-hosted

# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
branches: [master]

jobs:
build:
name: build with self-hosted runner
runs-on: self-hosted

steps:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- name: Prepare Nix
run: |
./ci/prepare-env/do.sh

- name: Build
run: |
[[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh
nix-build ./cross-build.nix

#- name: Test
#run: |
#nix-shell --run "cabal v2-test --enable-tests"

#- name: Build Docker Image
#run: |
#nix-build ./docker.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
### Haskell
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
*.prof
*.aux
*.hp
*.eventlog
.virtualenv
.hsenv
.hpc
.cabal-sandbox/
cabal.sandbox.config
cabal.config
.ghc.environment.*
.HTF/
# Stack
.stack-work/
stack.yaml.lock

### IDE/support
# Vim
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
*~
tags

# IntellijIDEA
.idea/
.ideaHaskellLib/
*.iml

# Atom
.haskell-ghc-mod.json

# VS
.vscode/

# Emacs
*#
TAGS

# other
.DS_Store

# nix
result
result-*

Loading

0 comments on commit e394a35

Please sign in to comment.