diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ab6ca09 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + ghc: ['8.4.4', '8.6.5', '9.0.2', '9.2.8', '9.4.8', '9.6.6', '9.8.4'] + env: + STACK_YAML: stack-ghc${{ matrix.ghc }}.yaml + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Haskell + uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + enable-stack: true + stack-version: 'latest' + + - name: Cache Haskell Tools + uses: actions/cache@v4 + with: + path: | + ${{ steps.setup-haskell.outputs.stack-root }} + .stack-work + ~/.ghcup + key: ${{ runner.os }}-haskell-${{ matrix.ghc }}-${{ hashFiles(env.STACK_YAML) }} + restore-keys: | + ${{ runner.os }}-haskell-${{ matrix.ghc }}- + + - name: Build + run: stack build --system-ghc + + - name: Test + run: stack test \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..73db2df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*.*' + +jobs: + release: + name: Release Job + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + # Extract version from the tag; e.g. if GITHUB_REF is "refs/tags/v0.2.1.0", + # this step sets the output "version" to "0.2.1.0". + - name: Extract Version + id: extract_version + run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Setup Haskell (Cabal) + uses: haskell-actions/setup@v2 + with: + ghc-version: '9.8.4' + + - name: Cabal Check + run: cabal check + + - name: Generate Haddock Documentation + run: cabal haddock --haddock-html --haddock-hoogle --builddir=dist/haddock + + - name: Build Source Distribution (Tarball for Hackage) + run: cabal sdist + + - name: "Debug: List Documentation Directory" + run: | + echo "Listing documentation directory contents:" + ls -R dist/haddock/build/x86_64-linux/ghc-9.8.4/socket-unix-${{ steps.extract_version.outputs.version }}/doc/html/socket-unix + + - name: Zip Haddock Documentation + run: | + cd dist/haddock/build/x86_64-linux/ghc-9.8.4/socket-unix-${{ steps.extract_version.outputs.version }}/doc/html/socket-unix + echo "Current directory contents before zipping:" + ls -la + # Zip only the contents of this directory into documentation.zip placed at the repository root. + zip -r ../../../../../../../../../documentation.zip . + + - name: Create GitHub Release and Upload Assets + uses: ncipollo/release-action@v1 + with: + tag: ${{ github.ref }} + name: Release ${{ steps.extract_version.outputs.version }} + artifacts: | + dist-newstyle/sdist/*.tar.gz + documentation.zip + + - name: "Debug: List Publish Directory" + run: | + echo "Listing publish directory contents:" + ls -R dist/haddock/build/x86_64-linux/ghc-9.8.4/socket-unix-${{ steps.extract_version.outputs.version }}/doc/html/socket-unix + + - name: Deploy Haddock Documentation to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: dist/haddock/build/x86_64-linux/ghc-9.8.4/socket-unix-${{ steps.extract_version.outputs.version }}/doc/html/socket-unix + destination_dir: ${{ steps.extract_version.outputs.version }} + + update-index: + name: Update Documentation Index + runs-on: ubuntu-latest + needs: release + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + - name: Set up Git user + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + - name: "Debug: List gh-pages Root" + run: | + echo "Listing gh-pages branch root:" + ls -R + - name: Update Documentation Index + run: | + chmod +x ./scripts/generate-index.sh + ./scripts/generate-index.sh + echo "After running generate-index.sh, listing files:" + ls -la + git add index.html + if ! git diff --cached --exit-code; then + git commit -m "Update documentation index" + git push origin gh-pages + else + echo "No changes to index.html" + fi diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f4b1c1c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +## [0.2.1.0] - 2025-03-20 +- Updated repository URL to [https://github.com/flip111/haskell-socket-unix](https://github.com/flip111/haskell-socket-unix). +- Package builds with GHC versions 8.4.4 (lts-12.26) to 9.8.4 (lts-23.15) + +## [v0.2.0.0] - 2017-02-25 + +- Release 0.2 be311e0 by VyacheslavHashov +- Adoptions for socket-0.8.0.0 f5e5940 by VyacheslavHashov +- Added default -O2 bd7d21d by VyacheslavHashov +- Changed resolver to lts-8.0 059844c by VyacheslavHashov + +## [v0.1.1.0] - 2017-01-22 + +- Added note in readme about os x fc3d276 by VyacheslavHashov +- Updated stack.yaml to ghc 8.0.2 0b1a768 by VyacheslavHashov +- Refactored tests 299d65d by VyacheslavHashov +- Travis file for Unix 2f8ebc4 by VyacheslavHashov +- Specific linux tests moved to separate directory 85e9f9e by VyacheslavHashov +- Support for OS X and Unix systems 7e3ffa2 by VyacheslavHashov +- Moved linux-specific code into separate directory 2ab662b by VyacheslavHashov + +## [v0.1.0.0] - 2017-01-10 + +- Added eNoEntry exception 8b7bab5 by VyacheslavHashov +- Fixed synopsis 08f965c by VyacheslavHashov +- Added synopsis in .cabal c31d3b6 by VyacheslavHashov +- Fixed description in .cabal 8a4b0fd by VyacheslavHashov +- Update README.md fa8b3af by Vyacheslav Hashov +- Added haddocks 6fa0e3b by VyacheslavHashov +- Set bounds for dependcies 6ac7012 by VyacheslavHashov +- Fixed stack filename 69f4940 by VyacheslavHashov +- Test on ghc 7.10.3 a0ef25c by VyacheslavHashov +- Split test-suite into default and threaded 6565601 by VyacheslavHashov +- Refactor source ee904a1 by VyacheslavHashov +- Refactor tests 02bbaef by VyacheslavHashov +- Option for not running tests in parallel 26f92f3 by VyacheslavHashov +- Added CI 86f63ec by VyacheslavHashov +- Tests for datagram sockets ba9aef0 by VyacheslavHashov +- Storable peek function for SocketAddress Unix 963226b by VyacheslavHashov +- Server/client tests contain send\recv 8eaa722 by VyacheslavHashov +- Test for sockets with address in abstract namespace 1870377 by VyacheslavHashov +- Tests for common unix domain sockets db5281f by VyacheslavHashov +- Support for common unix socket address and linux abstract namespace b1cce4d by VyacheslavHashov +- Base version d7ca652 by VyacheslavHashov +- Backbone 409def1 by VyacheslavHashov +- Initial commit 85259ee by Vyacheslav Hashov diff --git a/README.md b/README.md index fb37c25..76c3728 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ -[![Available on Hackage][badge-hackage]][hackage] -[![License MIT][badge-license]][license] -[![Build Status][badge-travis]][travis] +[![Available on Hackage](https://img.shields.io/hackage/v/socket-unix.svg?dummy)](https://hackage.haskell.org/package/socket-unix) +[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?dummy)](https://github.com/flip111/haskell-socket-unix/blob/master/LICENSE) +[![Build Status](https://github.com/flip111/haskell-socket-unix/actions/workflows/ci.yml/badge.svg)](https://github.com/flip111/haskell-socket-unix/actions) +[![Stackage LTS](https://stackage.org/package/socket-unix/badge/lts)](https://stackage.org/package/socket-unix) +[![GitHub release](https://img.shields.io/github/release/flip111/haskell-socket-unix.svg)](https://github.com/flip111/haskell-socket-unix/releases) + # socket-unix A Unix domain socket API for the [socket](https://github.com/lpeterse/haskell-socket) library. +This is a fork maintained at [GitHub](https://github.com/flip111/haskell-socket-unix). +Please refer to this repository for the latest updates, issue tracking, and contributions. + ## Usage Creating the Unix domain socket: ```haskell @@ -20,15 +26,9 @@ address <- case socketAddressUnixPath "example.sock" of Just addr -> pure addr Nothing -> putStrLn "invalid pathname for socket" ``` + ### Symlinks Binding to a socket with a filename creates a socket in the filesystem, but does not unlink it after `close` called. You should handle deleting links yourself. + ## Portability Linux and OS X are supported. - - -[badge-travis]: https://img.shields.io/travis/VyacheslavHashov/haskell-socket-unix.svg -[travis]: https://travis-ci.org/VyacheslavHashov/haskell-socket-unix -[badge-hackage]: https://img.shields.io/hackage/v/socket-unix.svg?dummy -[hackage]: https://hackage.haskell.org/package/socket-unix -[badge-license]: https://img.shields.io/badge/license-MIT-blue.svg?dummy -[license]: https://github.com/vyacheslavhashov/haskell-socket-unix/blob/master/LICENSE diff --git a/socket-unix.cabal b/socket-unix.cabal index 94c701b..2a602b2 100644 --- a/socket-unix.cabal +++ b/socket-unix.cabal @@ -1,18 +1,23 @@ +cabal-version: 2.2 + name: socket-unix -version: 0.2.0.0 +version: 0.2.1.0 synopsis: Unix domain sockets description: A Unix domain socket extension for the socket library -homepage: https://github.com/vyacheslavhashov/haskell-socket-unix#readme -license: MIT +homepage: https://github.com/flip111/haskell-socket-unix#readme +license: MIT license-file: LICENSE -author: Vyacheslav Hashov -maintainer: vyacheslavhashov@gmail.com +author: flip111, Vyacheslav Hashov +maintainer: flip101@gmail.com, vyacheslavhashov@gmail.com copyright: 2017 Vyacheslav Hashov category: System, Network stability: Experimental build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 +extra-source-files: README.md CHANGELOG.md + +source-repository head + type: git + location: https://github.com/flip111/haskell-socket-unix library hs-source-dirs: src @@ -23,11 +28,13 @@ library exposed-modules: System.Socket.Family.Unix other-modules: System.Socket.Family.Unix.Internal System.Socket.Family.Unix.Platform - build-depends: base >= 4.7 && < 5 - , socket >= 0.8.0.0 && < 0.9.0.0 - , bytestring >= 0.10.0.0 && < 0.11 + build-depends: + base >= 4.11 && < 5 + , socket == 0.8.3.0 + , bytestring >= 0.10 && < 0.13 - ghc-options: -Wall -O2 + ghc-options: + -Wall default-language: Haskell2010 test-suite default @@ -40,14 +47,15 @@ test-suite default main-is: test.hs other-modules: Internal Platform - build-depends: base >= 4.7 && < 5 - , socket >= 0.8.0.0 && < 0.9.0.0 - , socket-unix - , tasty >= 0.11 && < 0.12 - , tasty-hunit >= 0.9 && < 0.10 - , bytestring >= 0.10.0.0 && < 0.11 - , unix >= 2.7 && < 3.0 - , async >= 2.0 && < 2.3 + build-depends: + base >= 4.11 && < 5 + , socket == 0.8.3.0 + , socket-unix + , tasty >= 1.1 && < 1.6 + , tasty-hunit >= 0.10 && < 0.11 + , bytestring >= 0.10 && < 0.13 + , unix >= 2.7 && < 2.9 + , async >= 2.2 && < 2.3 default-language: Haskell2010 test-suite threaded @@ -60,17 +68,14 @@ test-suite threaded main-is: test.hs other-modules: Internal Platform - build-depends: base >= 4.7 && < 5 - , socket >= 0.8.0.0 && < 0.9.0.0 - , socket-unix - , tasty >= 0.11 && < 0.12 - , tasty-hunit >= 0.9 && < 0.10 - , bytestring >= 0.10.0.0 && < 0.11 - , unix >= 2.7 && < 3.0 - , async >= 2.0 && < 2.3 + build-depends: + base >= 4.11 && < 5 + , socket == 0.8.3.0 + , socket-unix + , tasty >= 1.1 && < 1.6 + , tasty-hunit >= 0.10 && < 0.11 + , bytestring >= 0.10 && < 0.13 + , unix >= 2.7 && < 2.9 + , async >= 2.2 && < 2.3 ghc-options: -threaded default-language: Haskell2010 - -source-repository head - type: git - location: https://github.com/vyacheslavhashov/haskell-socket-unix diff --git a/stack-ghc8.4.4.yaml b/stack-ghc8.4.4.yaml new file mode 100644 index 0000000..b64830c --- /dev/null +++ b/stack-ghc8.4.4.yaml @@ -0,0 +1,14 @@ +resolver: lts-12.26 + +packages: + - '.' + +extra-deps: + - socket-0.8.3.0 + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] + diff --git a/stack-ghc8.6.5.yaml b/stack-ghc8.6.5.yaml new file mode 100644 index 0000000..b554dab --- /dev/null +++ b/stack-ghc8.6.5.yaml @@ -0,0 +1,14 @@ +resolver: lts-14.27 + +packages: + - '.' + +extra-deps: + - socket-0.8.3.0 + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] + diff --git a/stack-ghc7.10.3.yaml b/stack-ghc9.0.2.yaml similarity index 78% rename from stack-ghc7.10.3.yaml rename to stack-ghc9.0.2.yaml index d577cab..3a60971 100644 --- a/stack-ghc7.10.3.yaml +++ b/stack-ghc9.0.2.yaml @@ -1,13 +1,12 @@ -resolver: lts-6.27 +resolver: lts-19.33 packages: -- '.' + - '.' extra-deps: - - socket-0.8.0.0 + - socket-0.8.3.0 # Override default flag values for local packages and extra-deps flags: {} # Extra package databases containing global packages extra-package-dbs: [] - diff --git a/stack-ghc8.0.2.yaml b/stack-ghc9.2.8.yaml similarity index 78% rename from stack-ghc8.0.2.yaml rename to stack-ghc9.2.8.yaml index 64e6e17..e547434 100644 --- a/stack-ghc8.0.2.yaml +++ b/stack-ghc9.2.8.yaml @@ -1,13 +1,12 @@ -resolver: lts-8.0 +resolver: lts-20.26 packages: -- '.' + - '.' extra-deps: - - socket-0.8.0.0 + - socket-0.8.3.0 # Override default flag values for local packages and extra-deps flags: {} # Extra package databases containing global packages extra-package-dbs: [] - diff --git a/stack-ghc9.4.8.yaml b/stack-ghc9.4.8.yaml new file mode 100644 index 0000000..05bc906 --- /dev/null +++ b/stack-ghc9.4.8.yaml @@ -0,0 +1,12 @@ +resolver: lts-21.25 + +packages: + - '.' +extra-deps: + - socket-0.8.3.0 + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] diff --git a/stack-ghc9.6.6.yaml b/stack-ghc9.6.6.yaml new file mode 100644 index 0000000..3e7f4cd --- /dev/null +++ b/stack-ghc9.6.6.yaml @@ -0,0 +1,12 @@ +resolver: lts-22.43 + +packages: + - '.' +extra-deps: + - socket-0.8.3.0 + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] diff --git a/stack-ghc9.8.4.yaml b/stack-ghc9.8.4.yaml new file mode 100644 index 0000000..c2402ca --- /dev/null +++ b/stack-ghc9.8.4.yaml @@ -0,0 +1,12 @@ +resolver: lts-23.15 + +packages: + - '.' +extra-deps: + - socket-0.8.3.0 + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] diff --git a/stack.yaml b/stack.yaml deleted file mode 120000 index a46c219..0000000 --- a/stack.yaml +++ /dev/null @@ -1 +0,0 @@ -stack-ghc8.0.2.yaml \ No newline at end of file