diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..af6ffb3 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [newhoggy] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml new file mode 100644 index 0000000..75bad83 --- /dev/null +++ b/.github/workflows/haskell.yml @@ -0,0 +1,185 @@ +name: Binaries + +defaults: + run: + shell: bash + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + ghc: ["9.0.1", "8.10.7", "8.8.4", "8.6.5"] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - uses: haskell/actions/setup@v1 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: 3.4.0.0 + + - name: Set some window specific things + if: matrix.os == 'windows-latest' + run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV + + - name: Configure project + run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ + + - name: Restore cabal cache + uses: haskell-works/cabal-cache-action@v1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }} + BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }} + BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }} + with: + args: | + sync-from-archive \ + --threads "$BINARY_CACHE_THREADS" \ + --archive-uri "$BINARY_CACHE_URI" \ + --region "$BINARY_CACHE_REGION" \ + --store-path "${{ steps.setup-haskell.outputs.cabal-store }}" + + - name: Build + # Try building it twice in case of flakey builds on Windows + run: | + cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ || \ + cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ -j1 + + - name: Test + run: | + cabal test all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ + + - name: Save cabal cache + uses: haskell-works/cabal-cache-action@v1 + if: ${{ always() }} + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }} + BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }} + BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }} + with: + args: | + sync-to-archive \ + --threads "$BINARY_CACHE_THREADS" \ + --archive-uri "$BINARY_CACHE_URI" \ + --region "$BINARY_CACHE_REGION" \ + --store-path "${{ steps.setup-haskell.outputs.cabal-store }}" + + check: + needs: build + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.tag }} + + steps: + - uses: actions/checkout@v2 + + - name: Check if cabal project is sane + run: | + PROJECT_DIR=$PWD + mkdir -p $PROJECT_DIR/build/sdist + for i in $(git ls-files | grep '\.cabal'); do + cd $PROJECT_DIR && cd `dirname $i` + cabal check + done + + - name: Tag new version + id: tag + if: ${{ github.ref == 'refs/heads/main' }} + env: + server: http://hackage.haskell.org + username: ${{ secrets.HACKAGE_USER }} + password: ${{ secrets.HACKAGE_PASS }} + run: | + package_version="$(cat *.cabal | grep '^version:' | cut -d : -f 2 | xargs)" + + echo "Package version is v$package_version" + + git fetch --unshallow origin + + if git tag "v$package_version"; then + echo "Tagging with new version "v$package_version"" + + if git push origin "v$package_version"; then + echo "Tagged with new version "v$package_version"" + + echo "::set-output name=tag::v$package_version" + fi + fi + + release: + needs: [build, check] + runs-on: ubuntu-latest + if: ${{ needs.check.outputs.tag != '' }} + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - uses: actions/checkout@v2 + + - name: Create source distribution + run: | + PROJECT_DIR=$PWD + mkdir -p $PROJECT_DIR/build/sdist + for i in $(git ls-files | grep '\.cabal'); do + cd $PROJECT_DIR && cd `dirname $i` + cabal v2-sdist -o $PROJECT_DIR/build/sdist + done; + + - name: Publish to hackage + env: + server: http://hackage.haskell.org + username: ${{ secrets.HACKAGE_USER }} + password: ${{ secrets.HACKAGE_PASS }} + candidate: false + run: | + package_version="$(cat *.cabal | grep '^version:' | cut -d : -f 2 | xargs)" + + for PACKAGE_TARBALL in $(find ./build/sdist/ -name "*.tar.gz"); do + PACKAGE_NAME=$(basename ${PACKAGE_TARBALL%.*.*}) + + if ${{ env.candidate }}; then + TARGET_URL="${{ env.server }}/packages/candidates"; + DOCS_URL="${{ env.server }}/package/$PACKAGE_NAME/candidate/docs" + else + TARGET_URL="${{ env.server }}/packages/upload"; + DOCS_URL="${{ env.server }}/package/$PACKAGE_NAME/docs" + fi + + HACKAGE_STATUS=$(curl --silent --head -w %{http_code} -XGET --anyauth --user "${{ env.username }}:${{ env.password }}" ${{ env.server }}/package/$PACKAGE_NAME -o /dev/null) + + if [ "$HACKAGE_STATUS" = "404" ]; then + echo "Uploading $PACKAGE_NAME to $TARGET_URL" + + curl -X POST -f --user "${{ env.username }}:${{ env.password }}" $TARGET_URL -F "package=@$PACKAGE_TARBALL" + echo "Uploaded $PACKAGE_NAME" + else + echo "Package $PACKAGE_NAME" already exists on Hackage. + fi + done + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: Undocumented + draft: true + prerelease: false diff --git a/hw-all.cabal b/hw-all.cabal index 129002a..d54334c 100644 --- a/hw-all.cabal +++ b/hw-all.cabal @@ -9,9 +9,9 @@ license: BSD-3-Clause license-file: LICENSE author: John Ky maintainer: newhoggy@gmail.com -copyright: 2016-2020 John Ky +copyright: 2016-2021 John Ky category: Data, Conduit -tested-with: GHC == 8.8.3, GHC == 8.6.5, GHC == 8.4.4 +tested-with: GHC == 9.0.1, GHC == 8.10.7, GHC == 8.8.4, GHC == 8.6.5 build-type: Simple extra-source-files: README.md @@ -27,7 +27,7 @@ common hw-balancedparens { build-depends: hw-balancedparens >= common hw-bits { build-depends: hw-bits >= 0.7.0.8 && < 0.8 } common hw-conduit { build-depends: hw-conduit >= 0.2.0.6 && < 0.3 } common hw-diagnostics { build-depends: hw-diagnostics >= 0.0.0.7 && < 0.1 } -common hw-dsv { build-depends: hw-dsv >= 0.3.7 && < 0.4 } +common hw-dsv { build-depends: hw-dsv >= 0.4 && < 0.5 } common hw-dump { build-depends: hw-dump >= 0.1.0.1 && < 0.2 } common hw-eliasfano { build-depends: hw-eliasfano >= 0.1.1.1 && < 0.2 } common hw-excess { build-depends: hw-excess >= 0.2.2.1 && < 0.3 } @@ -49,10 +49,9 @@ common hw-prim { build-depends: hw-prim >= common hw-rankselect { build-depends: hw-rankselect >= 0.13.3.1 && < 0.14 } common hw-rankselect-base { build-depends: hw-rankselect-base >= 0.3.2.3 && < 0.4 } common hw-simd { build-depends: hw-simd >= 0.1.1.5 && < 0.2 } -common hw-streams { build-depends: hw-streams >= 0.0.0.12 && < 0.1 } +common hw-streams { build-depends: hw-streams >= 0.0.1 && < 0.2 } common hw-string-parse { build-depends: hw-string-parse >= 0.0.0.4 && < 0.1 } common hw-succinct { build-depends: hw-succinct >= 0.1.0.1 && < 0.2 } -common hw-uri { build-depends: hw-uri >= 0.2.0.1 && < 0.3 } common hw-xml { build-depends: hw-xml >= 0.5.1.0 && < 0.6 } common config @@ -92,7 +91,6 @@ library , hw-streams , hw-string-parse , hw-succinct - , hw-uri , hw-xml hs-source-dirs: src exposed-modules: HaskellWorks