From cd770105d4573f1d2ac3facf783f27d4bb5573c4 Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 14:49:17 +0900 Subject: [PATCH 1/9] Remove old stack build plans --- stack-8.0.yaml | 5 ----- stack-8.2.yaml | 5 ----- stack-8.4.yaml | 5 ----- stack-8.6.yaml | 5 ----- stack-8.8.yaml | 7 ------- 5 files changed, 27 deletions(-) delete mode 100644 stack-8.0.yaml delete mode 100644 stack-8.2.yaml delete mode 100644 stack-8.4.yaml delete mode 100644 stack-8.6.yaml delete mode 100644 stack-8.8.yaml diff --git a/stack-8.0.yaml b/stack-8.0.yaml deleted file mode 100644 index 082557669..000000000 --- a/stack-8.0.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resolver: lts-9.21 -flags: {} -packages: - - location: '.' -extra-deps: [] diff --git a/stack-8.2.yaml b/stack-8.2.yaml deleted file mode 100644 index 80f381f47..000000000 --- a/stack-8.2.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resolver: lts-11.19 -flags: {} -packages: - - location: '.' -extra-deps: [] diff --git a/stack-8.4.yaml b/stack-8.4.yaml deleted file mode 100644 index f75b485e0..000000000 --- a/stack-8.4.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resolver: lts-12.5 -flags: {} -packages: - - location: '.' -extra-deps: [] diff --git a/stack-8.6.yaml b/stack-8.6.yaml deleted file mode 100644 index 9a4fa4322..000000000 --- a/stack-8.6.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resolver: lts-14.27 -flags: {} -packages: - - '.' -extra-deps: [] diff --git a/stack-8.8.yaml b/stack-8.8.yaml deleted file mode 100644 index 695193d87..000000000 --- a/stack-8.8.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -resolver: lts-16.5 -flags: {} -packages: - - '.' -extra-deps: [] From f6a4f38cf47b4e86587e7f7b8dce28d91d125b3a Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 14:50:42 +0900 Subject: [PATCH 2/9] Rename stack.yaml to stack-9.0.yaml --- stack.yaml => stack-9.0.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stack.yaml => stack-9.0.yaml (100%) diff --git a/stack.yaml b/stack-9.0.yaml similarity index 100% rename from stack.yaml rename to stack-9.0.yaml From a1dd4fe191afb0f30072411464b2a919a7947f42 Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 14:54:34 +0900 Subject: [PATCH 3/9] Update stack.yaml for ghc-8.10 and ghc-9.0 --- stack-8.10.yaml | 1 - stack-9.0.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/stack-8.10.yaml b/stack-8.10.yaml index 220fffcf6..68e5260b0 100644 --- a/stack-8.10.yaml +++ b/stack-8.10.yaml @@ -1,5 +1,4 @@ --- - resolver: lts-18.28 flags: {} packages: diff --git a/stack-9.0.yaml b/stack-9.0.yaml index b8109e651..3be543604 100644 --- a/stack-9.0.yaml +++ b/stack-9.0.yaml @@ -1,5 +1,5 @@ --- -resolver: lts-21.4 +resolver: lts-19.33 flags: {} packages: - "." From 7f2da4223d6ea4ef11c01de6d5a0d792b593850d Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 14:54:56 +0900 Subject: [PATCH 4/9] Add stack.yaml for ghc-9.4 and ghc-9.6 --- stack-9.4.yaml | 6 ++++++ stack-9.6.yaml | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 stack-9.4.yaml create mode 100644 stack-9.6.yaml diff --git a/stack-9.4.yaml b/stack-9.4.yaml new file mode 100644 index 000000000..58ac959cd --- /dev/null +++ b/stack-9.4.yaml @@ -0,0 +1,6 @@ +--- +resolver: lts-21.25 +flags: {} +packages: + - "." +extra-deps: [] diff --git a/stack-9.6.yaml b/stack-9.6.yaml new file mode 100644 index 000000000..3b4c1d267 --- /dev/null +++ b/stack-9.6.yaml @@ -0,0 +1,6 @@ +--- +resolver: lts-22.0 +flags: {} +packages: + - "." +extra-deps: [] From f6564b4f554dfaa6a35e7137a04d73d2ba1eaa2a Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 14:55:35 +0900 Subject: [PATCH 5/9] Add stack.yaml as softlink pointing to stack-9.6.yaml --- stack.yaml | 1 + 1 file changed, 1 insertion(+) create mode 120000 stack.yaml diff --git a/stack.yaml b/stack.yaml new file mode 120000 index 000000000..7d0a245a1 --- /dev/null +++ b/stack.yaml @@ -0,0 +1 @@ +./stack-9.6.yaml \ No newline at end of file From ed3477bef6a4a90873dab63fcabc524cc5ab4cd5 Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 15:51:47 +0900 Subject: [PATCH 6/9] Change Example.hs module name to Main This is necessary so that it can be added to the .cabal file as an executable. --- Example.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example.hs b/Example.hs index 1ab4c7868..d23cfb225 100644 --- a/Example.hs +++ b/Example.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module Example where +module Main where import Control.Monad.IO.Class (liftIO) import System.Metrics.Prometheus.Concurrent.RegistryT From f0b401e973e62a6ca44350ccad4570a18d9c331c Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 15:52:26 +0900 Subject: [PATCH 7/9] Regenerate the stack.yaml.lock file --- stack.yaml.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stack.yaml.lock b/stack.yaml.lock index 24d61c7a7..ff6601376 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - sha256: caa77fdbc5b9f698262b21ee78030133272ec53116ad6ddbefdc4c321f668e0c - size: 640014 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/4.yaml - original: lts-21.4 + sha256: e176944bc843f740e05242fa7a66ca1f440c127e425254f7f1257f9b19add23f + size: 712153 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/0.yaml + original: lts-22.0 From 57ca655f0177f8b2c4d2e7f0db0d2d37354cbe26 Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 15:52:49 +0900 Subject: [PATCH 8/9] Add the Example.hs file to the .cabal file as an executable --- prometheus.cabal | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/prometheus.cabal b/prometheus.cabal index cebe2c9be..fb91b64fb 100644 --- a/prometheus.cabal +++ b/prometheus.cabal @@ -60,6 +60,12 @@ description: extra-source-files: Example.hs , README.md +-- This flag builds the Example.hs file. It is only used for testing. It +-- is enabled in CI. +flag buildexamples + description: Build the Example.hs file. This is normally only used for testing. + default: False + library hs-source-dirs: src default-language: Haskell2010 @@ -95,6 +101,20 @@ library , wai >= 3.2 && < 3.3 , warp >= 3.2 && < 3.5 +executable prometheus-example + main-is: Example.hs + default-language: Haskell2010 + + ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind + + build-depends: base + , prometheus + + if flag(buildexamples) + buildable: True + else + buildable: False + source-repository head type: git location: https://github.com/bitnomial/prometheus From 27fa22723a67852ad856310241e860a4c28604ca Mon Sep 17 00:00:00 2001 From: Dennis Gosnell Date: Tue, 19 Dec 2023 15:53:01 +0900 Subject: [PATCH 9/9] Add GitHub Actions CI --- .github/workflows/ci.yml | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..e04c99b48 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +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: + - "8.10.7" + - "9.0.2" + - "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 --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-8.10.yaml" + - "--stack-yaml ./stack-9.0.yaml" + - "--stack-yaml ./stack-9.2.yaml" + - "--stack-yaml ./stack-9.4.yaml" + - "--stack-yaml ./stack-9.6.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:buildexamples + + # TODO: Actually add tests + # - name: Test + # run: | + # stack test