diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml deleted file mode 100644 index 29382f4..0000000 --- a/.devcontainer/compose.yaml +++ /dev/null @@ -1,21 +0,0 @@ -{ - "services": { - "devcontainer": { - "command": "sh -exc 'sleep infinity'", - "image": "public.ecr.aws/acilearning/haskell:9.6.2", - "init": true, - "volumes": [ - "..:/workspace", - "cabal-cache:/home/vscode/.cache/cabal", - "cabal-state:/home/vscode/.local/state/cabal" - ], - "working_dir": "/workspace" - } - }, - "volumes": { - "cabal-cache": null, - "cabal-state": { - "external": true - } - } -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index b200a0e..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "customizations": { - "vscode": { - "extensions": [ - "taylorfausak.purple-yolk" - ] - } - }, - "dockerComposeFile": "compose.yaml", - "initializeCommand": "docker volume create cabal-state", - "postCreateCommand": "cabal update", - "service": "devcontainer", - "workspaceFolder": "/workspace" -} diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml deleted file mode 100644 index 0fec246..0000000 --- a/.github/dependabot.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{ - "updates": [ - { - "directory": "/", - "package-ecosystem": "github-actions", - "schedule": { - "interval": "weekly" - } - } - ], - "version": 2 -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..49461d8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +updates: + - directory: / + package-ecosystem: github-actions + schedule: + interval: weekly +version: 2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e7db105 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,106 @@ +jobs: + build: + name: GHC ${{ matrix.ghc }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - run: mkdir artifact + - id: haskell + uses: haskell-actions/setup@v2 + with: + ghc-version: ${{ matrix.ghc }} + - run: ghc-pkg list + - run: cabal sdist --output-dir artifact + - run: cabal configure --enable-tests --flags=pedantic --jobs + - run: cat cabal.project.local + - run: cp cabal.project.local artifact + - run: cabal freeze + - run: cat cabal.project.freeze + - run: cp cabal.project.freeze artifact + - run: cabal outdated --v2-freeze-file + - uses: actions/cache@v4 + with: + key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} + path: ${{ steps.haskell.outputs.cabal-store }} + restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}- + - run: cabal build --only-download + - run: cabal build --only-dependencies + - run: cabal build + - run: tar --create --file artifact.tar --verbose artifact + - uses: actions/upload-artifact@v4 + with: + name: witch-${{ github.sha }}-${{ matrix.os }}-${{ matrix.ghc }} + path: artifact.tar + - run: cabal run -- witch-test-suite --randomize --strict + strategy: + matrix: + include: + - ghc: '9.10' + os: macos-13 + - ghc: '9.10' + os: macos-14 + - ghc: 9.6 + os: ubuntu-22.04 + - ghc: 9.8 + os: ubuntu-22.04 + - ghc: '9.10' + os: ubuntu-22.04 + - ghc: '9.10' + os: windows-2022 + cabal: + name: Cabal + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: cabal check + gild: + name: Gild + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: tfausak/cabal-gild-setup-action@v2 + - run: cabal-gild --input witch.cabal --mode check + hlint: + name: HLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: haskell-actions/hlint-setup@9e09cc3653fc13702000a35f638a27b064adfbbe + - uses: haskell-actions/hlint-run@v2 + with: + fail-on: status + ormolu: + name: Ormolu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: haskell-actions/run-ormolu@v15 + release: + if: ${{ github.event_name == 'release' }} + name: Release + needs: build + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: witch-${{ github.sha }}-ubuntu-22.04-9.10 + - run: tar --extract --file artifact.tar --verbose + - uses: softprops/action-gh-release@v2 + with: + files: artifact/witch-${{ github.event.release.tag_name }}.tar.gz + - run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/witch-${{ github.event.release.tag_name }}.tar.gz +name: CI +on: + pull_request: + branches: + - main + push: + branches: + - main + release: + types: + - created + schedule: + - cron: 0 0 * * 1 diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml deleted file mode 100644 index 66cbd39..0000000 --- a/.github/workflows/workflow.yaml +++ /dev/null @@ -1,199 +0,0 @@ -{ - "jobs": { - "build": { - "name": "Build on ${{ matrix.platform }} with GHC ${{ matrix.ghc }}", - "runs-on": "${{ matrix.platform }}-${{ matrix.version }}", - "steps": [ - { - "uses": "actions/checkout@v4" - }, - { - "run": "mkdir artifact" - }, - { - "id": "artifact", - "run": "echo 'directory=artifact/${{ matrix.platform }}-${{ matrix.ghc }}' >> $GITHUB_OUTPUT", - "shell": "bash" - }, - { - "run": "mkdir ${{ steps.artifact.outputs.directory }}" - }, - { - "id": "haskell", - "uses": "haskell-actions/setup@v2", - "with": { - "cabal-version": "3.10.2.1", - "ghc-version": "${{ matrix.ghc }}" - } - }, - { - "run": "cabal sdist --output-dir ${{ steps.artifact.outputs.directory }}" - }, - { - "run": "cabal configure --enable-optimization=2 --flags pedantic --jobs" - }, - { - "run": "cat cabal.project.local" - }, - { - "run": "cp cabal.project.local ${{ steps.artifact.outputs.directory }}" - }, - { - "run": "cabal freeze" - }, - { - "run": "cat cabal.project.freeze" - }, - { - "run": "cp cabal.project.freeze ${{ steps.artifact.outputs.directory }}" - }, - { - "run": "cabal outdated --v2-freeze-file cabal.project.freeze" - }, - { - "uses": "actions/cache@v3", - "with": { - "key": "${{ matrix.platform }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}", - "path": "${{ steps.haskell.outputs.cabal-store }}", - "restore-keys": "${{ matrix.platform }}-${{ matrix.ghc }}-" - } - }, - { - "run": "cabal build --only-download" - }, - { - "run": "cabal build --only-dependencies" - }, - { - "run": "cabal build" - }, - { - "uses": "actions/upload-artifact@v3", - "with": { - "name": "witch-${{ github.sha }}", - "path": "artifact" - } - }, - { - "run": "cabal run witch-test-suite" - } - ], - "strategy": { - "matrix": { - "include": [ - { - "ghc": "9.4.7", - "platform": "macos", - "version": "12" - }, - { - "ghc": "9.4.7", - "platform": "ubuntu", - "version": "22.04" - }, - { - "ghc": "9.6.2", - "platform": "ubuntu", - "version": "22.04" - }, - { - "ghc": "9.8.1", - "platform": "ubuntu", - "version": "22.04" - }, - { - "extension": ".exe", - "ghc": "9.4.7", - "platform": "windows", - "version": "2022" - } - ] - } - } - }, - "cabal": { - "name": "Cabal", - "runs-on": "ubuntu-22.04", - "steps": [ - { - "uses": "actions/checkout@v4" - }, - { - "run": "cabal check" - } - ] - }, - "hlint": { - "name": "HLint", - "runs-on": "ubuntu-22.04", - "steps": [ - { - "uses": "actions/checkout@v4" - }, - { - "uses": "haskell-actions/hlint-setup@v2", - "with": { - "version": 3.5 - } - }, - { - "uses": "haskell-actions/hlint-run@v2", - "with": { - "fail-on": "status" - } - } - ] - }, - "ormolu": { - "name": "Ormolu", - "runs-on": "ubuntu-22.04", - "steps": [ - { - "uses": "actions/checkout@v4" - }, - { - "uses": "haskell-actions/run-ormolu@v15" - } - ] - }, - "release": { - "if": "github.event_name == 'release'", - "name": "Release", - "needs": "build", - "runs-on": "ubuntu-22.04", - "steps": [ - { - "uses": "actions/download-artifact@v3", - "with": { - "name": "witch-${{ github.sha }}", - "path": "artifact" - } - }, - { - "uses": "svenstaro/upload-release-action@v2", - "with": { - "asset_name": "witch-${{ github.event.release.tag_name }}.tar.gz", - "file": "artifact/ubuntu-9.4.7/witch-${{ github.event.release.tag_name }}.tar.gz" - } - }, - { - "run": "cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/ubuntu-9.4.7/witch-${{ github.event.release.tag_name }}.tar.gz" - } - ] - } - }, - "name": "Workflow", - "on": { - "push": null, - "release": { - "types": [ - "created" - ] - }, - "schedule": [ - { - "cron": "0 0 * * 1" - } - ] - } -} diff --git a/.hlint.yaml b/.hlint.yaml index dac54d3..29f8672 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -1,29 +1,12 @@ -[ - { - "group": { - "enabled": true, - "name": "dollar" - } - }, - { - "group": { - "enabled": true, - "name": "generalise" - } - }, - { - "ignore": { - "name": "Use lambda-case" - } - }, - { - "ignore": { - "name": "Use tuple-section" - } - }, - { - "ignore": { - "name": "Redundant bracket" - } - } -] +- group: + enabled: true + name: dollar +- group: + enabled: true + name: generalise +- ignore: + name: Use lambda-case +- ignore: + name: Use tuple-section +- ignore: + name: Redundant bracket diff --git a/CHANGELOG.markdown b/CHANGELOG.md similarity index 100% rename from CHANGELOG.markdown rename to CHANGELOG.md diff --git a/LICENSE.markdown b/LICENSE.txt similarity index 100% rename from LICENSE.markdown rename to LICENSE.txt diff --git a/README.markdown b/README.markdown deleted file mode 100644 index a099742..0000000 --- a/README.markdown +++ /dev/null @@ -1,9 +0,0 @@ -# Witch - -[![Workflow](https://github.com/tfausak/witch/actions/workflows/workflow.yaml/badge.svg)](https://github.com/tfausak/witch/actions/workflows/workflow.yaml) -[![Hackage](https://img.shields.io/hackage/v/witch)](https://hackage.haskell.org/package/witch) -[![Stackage](https://www.stackage.org/package/witch/badge/nightly?label=stackage)](https://www.stackage.org/package/witch) - -:mage_woman: Convert values from one type into another. - -See the documentation on Hackage: . diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6d998b --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Witch + +[![CI](https://github.com/tfausak/witch/actions/workflows/ci.yml/badge.svg)](https://github.com/tfausak/witch/actions/workflows/ci.yml) +[![Hackage](https://badgen.net/hackage/v/witch)](https://hackage.haskell.org/package/witch) + +:mage_woman: Convert values from one type into another. + +See the documentation on Hackage: . diff --git a/witch.cabal b/witch.cabal index c5baab5..943774d 100644 --- a/witch.cabal +++ b/witch.cabal @@ -1,14 +1,15 @@ cabal-version: 2.2 - name: witch version: 1.2.1.0 synopsis: Convert values from one type into another. description: Witch converts values from one type into another. - build-type: Simple category: Data -extra-source-files: CHANGELOG.markdown README.markdown -license-file: LICENSE.markdown +extra-doc-files: + CHANGELOG.md + README.md + +license-file: LICENSE.txt license: MIT maintainer: Taylor Fausak @@ -18,17 +19,17 @@ source-repository head flag pedantic default: False - description: Enables @-Werror@, which turns warnings into errors. manual: True common library + build-depends: base ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0.0 build-depends: - , base >= 4.16.0 && < 4.20 - , bytestring >= 0.11.3 && < 0.13 - , containers >= 0.6.5 && < 0.8 - , tagged >= 0.8.6 && < 0.9 - , text >= 1.2.5 && < 1.3 || >= 2.0 && < 2.2 - , time >= 1.11.1 && < 1.13 + bytestring ^>=0.11.4.0 || ^>=0.12.0.2, + containers ^>=0.6.7 || ^>=0.7, + tagged ^>=0.8.8, + text ^>=2.0.2 || ^>=2.1, + time ^>=1.12.2 || ^>=1.14, + default-language: Haskell2010 ghc-options: -Weverything @@ -54,7 +55,6 @@ common library common executable import: library - build-depends: witch ghc-options: -rtsopts @@ -62,9 +62,10 @@ common executable library import: library - build-depends: - , template-haskell >= 2.18 && < 2.22 + template-haskell ^>=2.20.0.0 || ^>=2.21.0.0 || ^>=2.22.0.0 + + -- cabal-gild: discover source/library exposed-modules: Witch Witch.Encoding @@ -74,14 +75,15 @@ library Witch.TryFrom Witch.TryFromException Witch.Utility + hs-source-dirs: source/library test-suite witch-test-suite import: executable - build-depends: - , HUnit >= 1.6.1 && < 1.7 - , transformers >= 0.5.6 && < 0.7 + HUnit ^>=1.6.2.0, + transformers ^>=0.6.1.0, + hs-source-dirs: source/test-suite main-is: Main.hs type: exitcode-stdio-1.0