Skip to content

Commit

Permalink
Merge pull request #2 from bitnomial/fixup
Browse files Browse the repository at this point in the history
Add GitHub Actions CI
  • Loading branch information
GambolingPangolin authored Dec 19, 2023
2 parents a1b5adf + 27d24f6 commit 477a128
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 2 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

on:
pull_request:
push:
branches: [master]

jobs:
cabal:
name: cabal / ghc-${{ matrix.ghc }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macOS-latest
cabal:
- "latest"
ghc:
- "9.2.8"
- "9.4.8"
- "9.6.3"

steps:
- uses: actions/checkout@v4

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

- uses: actions/cache@v3
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ matrix.os }}-${{ matrix.ghc }}-cabal

- name: Build
run: |
cabal update
cabal build package:prometheus-wai-middleware --enable-tests --enable-benchmarks --write-ghc-environment-files=always --flags="buildexamples"
# TODO: Actually add tests
# - name: Test
# run: |
# cabal test package:prometheus --enable-tests

stack:
name: stack ${{ matrix.resolver }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - macOS-latest
stack: ["latest"]
resolver:
- "--stack-yaml ./stack.yaml"

steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
name: Setup Haskell Stack
with:
stack-version: ${{ matrix.stack }}
enable-stack: true

- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ matrix.os }}-stack-${{ matrix.resolver }}

- name: Build
run: |
stack build --test --bench --no-run-tests --no-run-benchmarks --flag prometheus-wai-middleware:buildexamples
# TODO: Actually add tests
# - name: Test
# run: |
# stack test
File renamed without changes.
12 changes: 12 additions & 0 deletions prometheus-wai-middleware.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ copyright: 2020 Bitnomial, Inc.
category: Web
build-type: Simple
extra-source-files: CHANGELOG.md
, README.md

source-repository head
type: git
location: https://github.com/bitnomial/prometheus-wai-middleware

-- This flag builds the example. It is only used for testing. It
-- is enabled in CI.
flag buildexamples
description: Build the example executable. This is normally only used for testing.
default: False

library
default-language: Haskell2010
hs-source-dirs: src/
Expand Down Expand Up @@ -44,3 +51,8 @@ executable prometheus-wai-middleware-example
, prometheus-wai-middleware
, wai ^>= 3.2
, warp >= 3.2 && < 3.5

if flag(buildexamples)
buildable: True
else
buildable: False
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resolver: lts-14.27
resolver: lts-21.25
extra-deps:
- prometheus-2.2.1
- "prometheus-2.2.4@sha256:a6691f50b6bd1b2e95138ca2fbd7c31c888da8b2c3157de1583eb99746f9d737,4288"
ghc-options:
"$locals": -Wall
19 changes: 19 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
hackage: prometheus-2.2.4@sha256:a6691f50b6bd1b2e95138ca2fbd7c31c888da8b2c3157de1583eb99746f9d737,4288
pantry-tree:
sha256: 4c6aa464e6f72cd68ad601c67682863331e1e02e4b4732b672603d922830aa12
size: 1559
original:
hackage: prometheus-2.2.4@sha256:a6691f50b6bd1b2e95138ca2fbd7c31c888da8b2c3157de1583eb99746f9d737,4288
snapshots:
- completed:
sha256: a81fb3877c4f9031e1325eb3935122e608d80715dc16b586eb11ddbff8671ecd
size: 640086
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/25.yaml
original: lts-21.25

0 comments on commit 477a128

Please sign in to comment.