From 36dcff8b81e31544aca2ae3edb97c504cc31ca62 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 17 Nov 2021 10:06:00 +0900 Subject: [PATCH] Fix broken build due to happy-1.21.0 https://github.com/simonmar/happy/issues/211 [changelog skip] --- .github/workflows/build.yaml | 56 +++++++++++++++------------------ .gitignore | 2 +- src/Text/Seonbi/ContentTypes.hs | 3 +- stack-ghc-8.10.yaml | 13 ++++++++ stack-ghc-8.8.yaml | 13 ++++++++ stack-ghc-9.0.yaml | 14 +++++++++ stack.yaml | 16 +--------- 7 files changed, 68 insertions(+), 49 deletions(-) create mode 100644 stack-ghc-8.10.yaml create mode 100644 stack-ghc-8.8.yaml create mode 100644 stack-ghc-9.0.yaml mode change 100644 => 120000 stack.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c94671f..5546715 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,10 +13,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, macos-10.15, windows-2019] - resolver: - - lts-16.31 - - lts-18.16 - - nightly-2021-11-06 + ghc-version: + - "8.8" + - "8.10" + - "9.0" + env: + STACK_YAML: stack-ghc-${{ matrix.ghc-version }}.yaml steps: - uses: actions/checkout@v2 - uses: dahlia/actions/setup-yq@main @@ -28,7 +30,7 @@ jobs: ~/.cabal/packages ~/.cabal/store ~/.stack - key: stack-${{ matrix.os }}-${{ matrix.resolver }} + key: stack-${{ matrix.os }}-ghc-${{ matrix.ghc-version }} - name: Cache Stack files (Windows) if: "startsWith(matrix.os, 'windows-')" uses: actions/cache@v2 @@ -37,25 +39,17 @@ jobs: %APPDATA%\cabal\packages %APPDATA%\cabal\store %APPDATA%\stack - key: stack-${{ matrix.os }}-${{ matrix.resolver }} + key: stack-${{ matrix.os }}-ghc-${{ matrix.version }} - name: Adjust Stack configuration - shell: bash - run: | - yq eval -i ' - .resolver = strenv(RESOLVER) - | .allow-newer = ( - .resolver | test("^lts-18.") or - .resolver | test("^nightly-") - ) - | .flags.seonbi.iconv = (strenv(OS) | test("^windows-") | not) - ' stack.yaml - env: - RESOLVER: ${{ matrix.resolver }} - OS: ${{ matrix.os }} + if: "startsWith(matrix.os, 'windows-')" + run: >- + yq eval + -i + '.flags.seonbi.iconv = false' + stack-ghc-${{ matrix.ghc-version }}.yaml - name: Set up resolver shell: bash run: | - cat stack.yaml # Try 3 times because this sometimes fails due to network error # on GitHub Actions. stack setup || stack setup || stack setup @@ -72,9 +66,9 @@ jobs: [[ "$tag_ver" = "$pkg_ver" ]] ! grep -i "to be released" CHANGES.md - name: Resolve dependencies - run: stack install --only-dependencies + run: stack install --test --only-dependencies - name: Build - run: stack build + run: stack build --test - name: Test run: stack test - name: Package source distribution @@ -90,12 +84,12 @@ jobs: if: startsWith(matrix.os, 'ubuntu-') uses: actions/upload-artifact@v2 with: - name: sdist-${{ matrix.os }}-${{ matrix.resolver }} + name: sdist-${{ matrix.os }}-ghc-${{ matrix.ghc-version }} path: /tmp/sdist - name: Build docs if: >- startsWith(matrix.os, 'ubuntu-') && - startsWith(matrix.resolver, 'lts-18.') + matrix.ghc-version == '8.8' shell: bash run: | curl -L -o /tmp/pandoc.deb \ @@ -109,13 +103,13 @@ jobs: - name: Copy docs if: >- startsWith(matrix.os, 'ubuntu-') && - startsWith(matrix.resolver, 'lts-18.') + matrix.ghc-version == '8.8' shell: bash run: cp -r "$(stack path --dist-dir)/doc/html/seonbi" .docs - name: Save docs if: >- startsWith(matrix.os, 'ubuntu-') && - startsWith(matrix.resolver, 'lts-18.') + matrix.ghc-version == '8.8' uses: actions/upload-artifact@v2 with: name: docs @@ -134,7 +128,7 @@ jobs: - name: Save executable binaries uses: actions/upload-artifact@v2 with: - name: binaries-${{ matrix.os }}-${{ matrix.resolver }} + name: binaries-${{ matrix.os }}-ghc-${{ matrix.ghc-version }} path: .bin deno: @@ -153,7 +147,7 @@ jobs: deno-version: v1.x - uses: actions/download-artifact@v2 with: - name: binaries-${{ matrix.os }}-lts-16.31 + name: binaries-${{ matrix.os }}-ghc-8.8 path: ${{ runner.temp }}/bin - run: chmod +x ${{ runner.temp }}/bin/* if: "!startsWith(matrix.os, 'windows-')" @@ -271,11 +265,11 @@ jobs: steps: - uses: actions/download-artifact@v2 with: - name: binaries-macos-10.15-lts-16.31 + name: binaries-macos-10.15-ghc-8.8 path: /tmp/binaries-macos - uses: actions/download-artifact@v2 with: - name: binaries-windows-2019-lts-16.31 + name: binaries-windows-2019-ghc-8.8 path: /tmp/binaries-windows - uses: actions/download-artifact@v2 with: @@ -329,7 +323,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/download-artifact@v2 with: - name: sdist-ubuntu-20.04-lts-16.31 + name: sdist-ubuntu-20.04-ghc-8.8 path: /tmp/sdist - uses: actions/download-artifact@v2 with: diff --git a/.gitignore b/.gitignore index be8a0a5..b5d6b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ dist-newstyle/ out/ seonbi.iml src/Text/Seonbi/kHangul.txt -stack.yaml.lock +stack*.yaml.lock diff --git a/src/Text/Seonbi/ContentTypes.hs b/src/Text/Seonbi/ContentTypes.hs index bb6d52e..5d34045 100644 --- a/src/Text/Seonbi/ContentTypes.hs +++ b/src/Text/Seonbi/ContentTypes.hs @@ -268,8 +268,7 @@ asCommonMarkTransformer transformer input = do attr' :: Show a => ST.Text -> a -> ST.Text attr' name = ST.cons ' ' . attr name posAttr :: Maybe PosInfo -> ST.Text - posAttr info = - attr "posinfo" info + posAttr = attr "posinfo" getRawAttr :: HtmlRawAttrs -> ST.Text -> Maybe ST.Text getRawAttr attrs name = case ST.breakOn prefix attrs of diff --git a/stack-ghc-8.10.yaml b/stack-ghc-8.10.yaml new file mode 100644 index 0000000..b4e6075 --- /dev/null +++ b/stack-ghc-8.10.yaml @@ -0,0 +1,13 @@ +resolver: lts-18.16 +packages: +- . +extra-deps: +- bytestring-trie-0.2.5.0 +- html-charset-0.1.0 +flags: + seonbi: + iconv: true +allow-newer: true +ghc-options: + "$locals": -fhide-source-paths +require-stack-version: ">=2.7.0" diff --git a/stack-ghc-8.8.yaml b/stack-ghc-8.8.yaml new file mode 100644 index 0000000..835e4ff --- /dev/null +++ b/stack-ghc-8.8.yaml @@ -0,0 +1,13 @@ +resolver: lts-16.31 +packages: +- . +extra-deps: +- bytestring-trie-0.2.5.0 +- html-charset-0.1.0 +flags: + seonbi: + iconv: true +allow-newer: false +ghc-options: + "$locals": -fhide-source-paths +require-stack-version: ">=2.7.0" diff --git a/stack-ghc-9.0.yaml b/stack-ghc-9.0.yaml new file mode 100644 index 0000000..4e71f87 --- /dev/null +++ b/stack-ghc-9.0.yaml @@ -0,0 +1,14 @@ +resolver: nightly-2021-11-15 +packages: +- . +extra-deps: +- bytestring-trie-0.2.5.0 +- html-charset-0.1.0 +- happy-1.20.0 # https://github.com/simonmar/happy/issues/211 +flags: + seonbi: + iconv: true +allow-newer: true +ghc-options: + "$locals": -fhide-source-paths +require-stack-version: ">=2.7.0" diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 4ae522b..0000000 --- a/stack.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# The resolve and some configurations are adjusted during the workflow in -# GitHub Actions. See also .github/workflows/build.yaml script. -resolver: lts-16.31 -packages: -- . -extra-deps: -- bytestring-trie-0.2.5.0 -- html-charset-0.1.0 -flags: - seonbi: - iconv: true -allow-newer: false # should be turned on where resolver is lts-18.* or later -ghc-options: - "$locals": -fhide-source-paths -require-stack-version: ">=2.7.0" diff --git a/stack.yaml b/stack.yaml new file mode 120000 index 0000000..6c046eb --- /dev/null +++ b/stack.yaml @@ -0,0 +1 @@ +stack-ghc-8.8.yaml \ No newline at end of file