Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Oct 17, 2024
0 parents commit 914a310
Show file tree
Hide file tree
Showing 19 changed files with 8,658 additions and 0 deletions.
192 changes: 192 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# packcheck-0.7.0
# You can use any of the options supported by packcheck as environment
# variables here. See https://github.com/composewell/packcheck for all
# options and their explanation.

name: packcheck

#-----------------------------------------------------------------------------
# Events on which the build should be triggered
#-----------------------------------------------------------------------------

on:
push:
branches:
- master
pull_request:


#-----------------------------------------------------------------------------
# Build matrix
#-----------------------------------------------------------------------------

jobs:
build:
name: >-
${{ matrix.name }}
${{ matrix.command }}
${{ matrix.runner }}
${{ matrix.ghc_version }}
env:
# ------------------------------------------------------------------------
# Common options
# ------------------------------------------------------------------------
# GHC_OPTIONS: "-Werror"
CABAL_REINIT_CONFIG: y
LC_ALL: C.UTF-8

# ------------------------------------------------------------------------
# What to build
# ------------------------------------------------------------------------
# DISABLE_TEST: "y"
# DISABLE_BENCH: "y"
# DISABLE_DOCS: "y"
DISABLE_SDIST_BUILD: ${{ matrix.disable_sdist_build }}
# DISABLE_SDIST_GIT_CHECK: "y"
# DISABLE_DIST_CHECKS: "y"

# ------------------------------------------------------------------------
# Selecting tool versions
# ------------------------------------------------------------------------
# For updating see: https://downloads.haskell.org/~ghcup/
GHCUP_VERSION: 0.1.20.0
GHCVER: ${{ matrix.ghc_version }}
GHCUP_GHC_OPTIONS: ${{ matrix.ghcup_ghc_options }}
# RESOLVER: ${{ matrix.stack_resolver }}

# ------------------------------------------------------------------------
# stack options
# ------------------------------------------------------------------------
# Note requiring a specific version of stack using STACKVER may fail due to
# github API limit while checking and upgrading/downgrading to the specific
# version.
#STACKVER: "1.6.5"
#STACK_UPGRADE: "y"
STACK_YAML: "stack.yaml"

# ------------------------------------------------------------------------
# cabal options
# ------------------------------------------------------------------------
CABAL_CHECK_RELAX: y
CABAL_HACKAGE_MIRROR: "hackage.haskell.org:http://hackage.fpcomplete.com"
CABAL_PROJECT: ${{ matrix.cabal_project }}

# ------------------------------------------------------------------------
# Where to find the required tools
# ------------------------------------------------------------------------
PATH: /opt/ghc/bin:/sbin:/usr/sbin:/bin:/usr/bin
#TOOLS_DIR: /opt

# ------------------------------------------------------------------------
# Location of packcheck.sh (the shell script invoked to perform CI tests ).
# ------------------------------------------------------------------------
# You can either commit the packcheck.sh script at this path in your repo or
# you can use it by specifying the PACKCHECK_REPO_URL option below in which
# case it will be automatically copied from the packcheck repo to this path
# during CI tests. In any case it is finally invoked from this path.
PACKCHECK: "./packcheck.sh"
# If you have not committed packcheck.sh in your repo at PACKCHECK
# then it is automatically pulled from this URL.
PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
PACKCHECK_GITHUB_COMMIT: "7c4e1ab7a59b5ed6e92cfd0da67460a6116be4ac"

# ------------------------------------------------------------------------
# Final build variables
# ------------------------------------------------------------------------
PACKCHECK_COMMAND: ${{ matrix.command }} ${{ matrix.pack_options }}

# ubuntu seems to have better support than debian on CI systems
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
# The name of the CI is built using the name and other info from CI,
# therefore, the "name" field is same for all tests here.
#
# The reason we have an explicit "name" field here is to force
# an additional config instead of adding to an existing config
# while adding additional configs.
# Look at <https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix>
# for more info about adding matrix elements.
# Adding any element to the list will increase the number of matrix
# elements proportional to the cross product.
include:

- name: ci
command: cabal
runner: ubuntu-latest
ghc_version: 9.8.1
cabal_project: cabal.project

- name: ci
command: cabal
runner: ubuntu-latest
ghc_version: 9.6.3
cabal_project: cabal.project

- name: ci
command: cabal
runner: macos-latest
ghc_version: 9.4.7
cabal_project: cabal.project
disable_sdist_build: "y"

- name: ci
command: stack
runner: ubuntu-latest
disable_sdist_build: "y"

- name: ci
ghc_version: 9.2.8
command: cabal
runner: macos-latest
cabal_project: cabal.project
disable_sdist_build: "y"

- name: ci
command: cabal
runner: windows-latest
ghc_version: 9.0.2
cabal_project: cabal.project
disable_sdist_build: "y"

- name: ci
command: hlint
runner: ubuntu-latest
pack_options: >-
HLINT_VERSION=3.6.1
HLINT_OPTIONS="lint"
HLINT_TARGETS="src"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
name: Cache common directories
with:
path: |
~/.local
~/.cabal
~/.stack
~/.ghcup
key: ${{ matrix.command }}-${{ matrix.ghc_version }}-${{ matrix.runner }}

- name: Download packcheck
run: |
if test ! -e "$PACKCHECK"
then
if test -z "$PACKCHECK_GITHUB_COMMIT"
then
die "PACKCHECK_GITHUB_COMMIT is not specified."
fi
PACKCHECK_URL=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck.sh
curl --fail -sL -o "$PACKCHECK" $PACKCHECK_URL || exit 1
chmod +x $PACKCHECK
elif test ! -x "$PACKCHECK"
then
chmod +x $PACKCHECK
fi
- name: Run packcheck
run: |
export PATH=$HOME/.local/bin:$HOME/.ghcup/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/opt/curl/bin
bash -c "$PACKCHECK $PACKCHECK_COMMAND"
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Build files/directories
.stack-work/
dist/
dist-newstyle*/
.cabal.nix
autom4te.cache/
benchmark/bench-report/bin/bench-report
charts/

# Local GHC and Cabal related files
.ghc.environment*
cabal.project.local

# Temp files created by Vim/Neovim
*.swp
*.swo
*~

# Other
.log
_doctests/
85 changes: 85 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################

# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project


# Warnings currently triggered by your code
- suggest: {name: "Unused LANGUAGE pragma"}
- suggest: {name: "Eta reduce"}

# Warnings currently ignored
- ignore: {name: "Use list literal pattern"}
- ignore: {name: "Use tuple-section"} # requires GHC extension
- ignore: {name: "Use fromMaybe"} # may want to use this suggestion, but it didn't match the common idiom of the library
- ignore: {name: "Use unless"} # low power-to-weight
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use <>"}
- ignore: {name: "Use fewer imports"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Redundant $!"}
- ignore: {name: "Use fmap"}
- ignore: {name: "Use ++"}
- ignore: {name: "Replace case with maybe"} # case is more readable
- ignore: {name: "Use mapMaybe"} # does not make any difference

# Specify additional command line arguments
#
- arguments:
[ --cpp-include=src
, --cpp-define=CABAL_OS_LINUX
, --cpp-define=linux_HOST_OS
]


# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules


# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}


# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
- warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
- group: {name: generalise, enabled: true}


# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules


# Define some custom infix operators
# - fixity: infixr 3 ~^#^~


# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml
6 changes: 6 additions & 0 deletions .packcheck.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.github/workflows/haskell.yml
.gitignore
.packcheck.ignore
cabal.project
stack.yaml
.hlint.yaml
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.1.0

- Initial release
Loading

0 comments on commit 914a310

Please sign in to comment.