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..9ceeea9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,113 @@ +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-optimization=2 --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: cp $( cabal list-bin github-release ) artifact + - run: tar --create --file artifact.tar --verbose artifact + - uses: actions/upload-artifact@v4 + with: + name: github-release-${{ github.sha }}-ghc-${{ matrix.ghc }}-${{ matrix.os }} + path: artifact.tar + 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 + 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 + gild: + name: Gild + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: tfausak/cabal-gild-setup-action@v2 + - run: cabal-gild --input github-release.cabal --mode check + ormolu: + name: Ormolu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: haskell-actions/run-ormolu@v15 + release: + env: + PREFIX: github-release-${{ github.event.release.tag_name }} + if: ${{ github.event_name == 'release' }} + name: Release + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + - run: sh -exc 'for d in *; do cd $d; tar --extract --file artifact.tar --verbose; cd ..; done' + - run: cp github-release-${{ github.sha }}-ghc-9.10-ubuntu-22.04/artifact/${{ env.PREFIX }}.tar.gz . + - run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-darwin-x64.tar.gz --verbose github-release + working-directory: github-release-${{ github.sha }}-ghc-9.10-macos-13/artifact + - run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-darwin-arm64.tar.gz --verbose github-release + working-directory: github-release-${{ github.sha }}-ghc-9.10-macos-14/artifact + - run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-linux-x64.tar.gz --verbose github-release + working-directory: github-release-${{ github.sha }}-ghc-9.10-ubuntu-22.04/artifact + - run: tar --auto-compress --create --file ../../${{ env.PREFIX }}-win32-x64.tar.gz --verbose github-release.exe + working-directory: github-release-${{ github.sha }}-ghc-9.10-windows-2022/artifact + - uses: softprops/action-gh-release@v2 + with: + files: ${{ env.PREFIX }}*.tar.gz + - run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' ${{ env.PREFIX }}.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 5f9d60d..0000000 --- a/.github/workflows/workflow.yaml +++ /dev/null @@ -1,230 +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" - }, - { - "run": "cp \"$( cabal list-bin github-release )\" ${{ steps.artifact.outputs.directory }}" - }, - { - "uses": "svenstaro/upx-action@v2", - "with": { - "files": "${{ steps.artifact.outputs.directory }}/github-release${{ matrix.extension }}" - } - }, - { - "uses": "actions/upload-artifact@v3", - "with": { - "name": "github-release-${{ github.sha }}", - "path": "artifact" - } - } - ], - "strategy": { - "matrix": { - "include": [ - { - "ghc": "9.8.1", - "platform": "macos", - "version": "12" - }, - { - "ghc": "9.4.8", - "platform": "ubuntu", - "version": "22.04" - }, - { - "ghc": "9.6.4", - "platform": "ubuntu", - "version": "22.04" - }, - { - "ghc": "9.8.1", - "platform": "ubuntu", - "version": "22.04" - }, - { - "extension": ".exe", - "ghc": "9.8.1", - "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": "github-release-${{ github.sha }}", - "path": "artifact" - } - }, - { - "uses": "svenstaro/upload-release-action@v2", - "with": { - "asset_name": "github-release-${{ github.event.release.tag_name }}-ubuntu", - "file": "artifact/ubuntu-9.8.1/github-release", - "tag": "${{ github.event.release.tag_name }}" - } - }, - { - "uses": "svenstaro/upload-release-action@v2", - "with": { - "asset_name": "github-release-${{ github.event.release.tag_name }}-macos", - "file": "artifact/macos-9.8.1/github-release", - "tag": "${{ github.event.release.tag_name }}" - } - }, - { - "uses": "svenstaro/upload-release-action@v2", - "with": { - "asset_name": "github-release-${{ github.event.release.tag_name }}-windows.exe", - "file": "artifact/windows-9.8.1/github-release.exe", - "tag": "${{ github.event.release.tag_name }}" - } - }, - { - "uses": "svenstaro/upload-release-action@v2", - "with": { - "asset_name": "github-release-${{ github.event.release.tag_name }}.tar.gz", - "file": "artifact/ubuntu-9.8.1/github-release-${{ github.event.release.tag_name }}.tar.gz", - "tag": "${{ github.event.release.tag_name }}" - } - }, - { - "run": "cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/ubuntu-9.8.1/github-release-${{ 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 b4af990..86b48cf 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -1,24 +1,10 @@ -[ - { - "group": { - "enabled": true, - "name": "dollar" - } - }, - { - "group": { - "enabled": true, - "name": "generalise" - } - }, - { - "ignore": { - "name": "Use lambda-case" - } - }, - { - "ignore": { - "name": "Use tuple-section" - } - } -] +- group: + enabled: true + name: dollar +- group: + enabled: true + name: generalise +- ignore: + name: Use lambda-case +- ignore: + name: Use tuple-section 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 96% rename from LICENSE.markdown rename to LICENSE.txt index 43a59de..37d6ed7 100644 --- a/LICENSE.markdown +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Taylor Fausak +Copyright (c) 2024 Taylor Fausak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.markdown b/README.md similarity index 77% rename from README.markdown rename to README.md index c59b6e3..59d0ab9 100644 --- a/README.markdown +++ b/README.md @@ -1,8 +1,7 @@ # [GitHub Release][] -[![Workflow](https://github.com/tfausak/github-release/actions/workflows/workflow.yaml/badge.svg)](https://github.com/tfausak/github-release/actions/workflows/workflow.yaml) -[![Hackage](https://img.shields.io/hackage/v/github-release)](https://hackage.haskell.org/package/github-release) -[![Stackage](https://www.stackage.org/package/github-release/badge/nightly?label=stackage)](https://www.stackage.org/package/github-release) +[![CI](https://github.com/tfausak/github-release/actions/workflows/ci.yml/badge.svg)](https://github.com/tfausak/github-release/actions/workflows/ci.yml) +[![Hackage](https://badgen.net/hackage/v/github-release)](https://hackage.haskell.org/package/github-release) GitHub Release is a command-line utility for uploading files to GitHub releases. diff --git a/cabal.project b/cabal.project index ae834b3..e6fdbad 100644 --- a/cabal.project +++ b/cabal.project @@ -1,9 +1 @@ packages: . - -allow-newer: - -- https://github.com/tfausak/burrito/pull/23 - , burrito:base - , burrito:template-haskell - , burrito:text - , burrito:transformers - , optparse-generic:text diff --git a/github-release.cabal b/github-release.cabal index ee8bf65..3b8dd18 100644 --- a/github-release.cabal +++ b/github-release.cabal @@ -1,15 +1,15 @@ cabal-version: 2.2 - name: github-release version: 2.0.0.10 - synopsis: Upload files to GitHub releases. description: GitHub Release uploads files to GitHub releases. - build-type: Simple category: Utility -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 @@ -23,18 +23,7 @@ flag pedantic manual: True common library - build-depends: - , aeson >= 2.0.3 && < 2.3 - , base >= 4.16.0 && < 4.20 - , burrito >= 1.2.0 && < 1.3 || >= 2.0.0 && < 2.1 - , bytestring >= 0.11.3 && < 0.13 - , http-client >= 0.7.13 && < 0.8 - , http-client-tls >= 0.3.6 && < 0.4 - , http-types >= 0.12.3 && < 0.13 - , mime-types >= 0.1.0 && < 0.2 - , optparse-generic >= 1.4.8 && < 1.6 - , text >= 1.2.5 && < 1.3 || >= 2.0 && < 2.2 - , unordered-containers >= 0.2.17 && < 0.3 + build-depends: base ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0.0 default-language: Haskell2010 ghc-options: -Weverything @@ -54,23 +43,31 @@ common library common executable import: library - build-depends: github-release ghc-options: -rtsopts -threaded - -Wno-unused-packages library import: library - autogen-modules: Paths_github_release + build-depends: + aeson ^>=2.1.2.1 || ^>=2.2.2.0, + burrito ^>=2.0.1.9, + bytestring ^>=0.11.4.0 || ^>=0.12.0.2, + http-client ^>=0.7.17, + http-client-tls ^>=0.3.6.3, + http-types ^>=0.12.4, + mime-types ^>=0.1.2.0, + optparse-generic ^>=1.5.2, + text ^>=2.0.2 || ^>=2.1, + unordered-containers ^>=0.2.20, + exposed-modules: GitHubRelease hs-source-dirs: source/library other-modules: Paths_github_release executable github-release import: executable - hs-source-dirs: source/executable main-is: Main.hs