<commit_before>name: Cryptol
on:
  push:
    branches: [master, "release-**"]
  pull_request:

jobs:
  outputs:
    runs-on: ubuntu-latest
    outputs:
      changed: ${{ steps.outputs.outputs.changed-files }}
      cryptol-version: ${{ steps.outputs.outputs.cryptol-version }}
      name: ${{ steps.outputs.outputs.name }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - id: outputs
        run: |
          .github/ci.sh set_files ${{ github.sha }}
          .github/ci.sh set_version
          .github/ci.sh output name cryptol-$(.github/ci.sh ver)

  build:
    runs-on: ${{ matrix.os }}
    needs: [outputs]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        ghc: ["8.6.5", "8.8.3", "8.10.1"]
        exclude:
          # The process-1.6.8 library contains a memory leak on windows,
          # causing RAM constrained builds to sometimes fail.
          # Technically, windows+GHC 8.10.1 should also likely be excluded, but
          # we use GHC 8.10.1 for releases currently.
          #
          # https://gitlab.haskell.org/ghc/ghc/-/issues/17926
          # TODO: remove when 8.8.4 and 8.10.2 are released
          - os: windows-latest
            ghc: 8.8.3
    name: Cryptol - GHC v${{ matrix.ghc }} - ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true

      - uses: actions/setup-haskell@v1
        id: setup-haskell
        with:
          ghc-version: ${{ matrix.ghc }}

      - uses: actions/cache@v1
        name: Cache cabal store
        with:
          path: ${{ steps.setup-haskell.outputs.cabal-store }}
          # https://github.com/actions/cache/issues/109 "Enable always writing cache to support hermetic build systems"
          # https://github.com/actions/cache/issues/239#issuecomment-606950711 Investigate this workaround if cache starts filling up
          key: store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }}
          restore-keys: |
            store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-
            store-${{ runner.os }}-${{ matrix.ghc }}-
            store-${{ runner.os }}-

      - uses: actions/cache@v1
        name: Cache dist-newstyle
        with:
          path: dist-newstyle
          key: dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }}
          restore-keys: |
            dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-
            dist-${{ runner.os }}-${{ matrix.ghc }}-

      - shell: bash
        run: .github/ci.sh install_system_deps
        env:
          Z3_VERSION: "4.8.7"
          CVC4_VERSION: "4.1.8"
          YICES_VERSION: "2.6.2"

      - shell: bash
        run: .github/ci.sh setup_external_tools

      - shell: bash
        run: .github/ci.sh build

      - shell: bash
        run: .github/ci.sh test_dist

      - if: >-
          (startsWith(github.head_ref, 'releases-')
            || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/')))
          && matrix.ghc == '8.10.1'
        uses: actions/upload-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

  docs:
    runs-on: ubuntu-latest
    needs: [outputs]
    if: >-
      (startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request'
            && startsWith(github.head_ref, 'actions/')))
      || contains(needs.outputs.outputs.changed, 'docs/')
    steps:
      - uses: actions/checkout@v2
      - uses: docker://pandoc/latex:latest
        with:
          args: >-
            sh -c
            "
            apk add make &&
            tlmgr install subfigure lastpage preprint adjustbox nag collectbox sectsty todonotes palatino mathpazo &&
            cd docs &&
            make
            "
      - uses: actions/upload-artifact@v2
        with:
          path: docs
          name: docs

  bundle:
    runs-on: ${{ matrix.os }}
    if: >-
      startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/'))
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        ghc: ["8.10.1"]
    needs: [outputs, docs, build]
    env:
      VERSION: ${{ needs.outputs.outputs.cryptol-version }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/download-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

      - uses: actions/download-artifact@v2
        with:
          path: docs
          name: docs

      - shell: bash
        run: .github/ci.sh bundle_files

      - if: runner.os == 'Windows'
        run: .github/wix.ps1

      - if: runner.os == 'Windows'
        shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh sign cryptol.msi

      - shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh zip_dist

      - uses: actions/upload-artifact@v2
        if: runner.os != 'Windows'
        with:
          name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
          path: "${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64.tar.gz*"

      - uses: actions/upload-artifact@v2
        if: runner.os == 'Windows'
        with:
          name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
          path: "cryptol.msi*"

  release:
    needs: [outputs, bundle, release]
    if: >-
      startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/'))
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: release-drafter/release-drafter@v5
        id: release
        with:
          version: v${{ needs.outputs.outputs.cryptol-version }}
          name: v${{ needs.outputs.outputs.cryptol-version }}
          tag: v${{ needs.outputs.outputs.cryptol-version }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - uses: actions/download-artifact@v2
        with:
          path: artifacts
      - name: Upload artifacts to release
        run: |
          # workaround for draft-releaser being hard to test in CI
          tag="v${VERSION}"
          body="${body:-$tag}"
          if ! hub release show "$tag"; then
            hub release create -d -m "$body" "$tag"
          fi
          assets=()<commit_msg>fix cycle in yaml<commit_after>name: Cryptol
on:
  push:
    branches: [master, "release-**"]
  pull_request:

jobs:
  outputs:
    runs-on: ubuntu-latest
    outputs:
      changed: ${{ steps.outputs.outputs.changed-files }}
      cryptol-version: ${{ steps.outputs.outputs.cryptol-version }}
      name: ${{ steps.outputs.outputs.name }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - id: outputs
        run: |
          .github/ci.sh set_files ${{ github.sha }}
          .github/ci.sh set_version
          .github/ci.sh output name cryptol-$(.github/ci.sh ver)

  build:
    runs-on: ${{ matrix.os }}
    needs: [outputs]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        ghc: ["8.6.5", "8.8.3", "8.10.1"]
        exclude:
          # The process-1.6.8 library contains a memory leak on windows,
          # causing RAM constrained builds to sometimes fail.
          # Technically, windows+GHC 8.10.1 should also likely be excluded, but
          # we use GHC 8.10.1 for releases currently.
          #
          # https://gitlab.haskell.org/ghc/ghc/-/issues/17926
          # TODO: remove when 8.8.4 and 8.10.2 are released
          - os: windows-latest
            ghc: 8.8.3
    name: Cryptol - GHC v${{ matrix.ghc }} - ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true

      - uses: actions/setup-haskell@v1
        id: setup-haskell
        with:
          ghc-version: ${{ matrix.ghc }}

      - uses: actions/cache@v1
        name: Cache cabal store
        with:
          path: ${{ steps.setup-haskell.outputs.cabal-store }}
          # https://github.com/actions/cache/issues/109 "Enable always writing cache to support hermetic build systems"
          # https://github.com/actions/cache/issues/239#issuecomment-606950711 Investigate this workaround if cache starts filling up
          key: store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }}
          restore-keys: |
            store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-
            store-${{ runner.os }}-${{ matrix.ghc }}-
            store-${{ runner.os }}-

      - uses: actions/cache@v1
        name: Cache dist-newstyle
        with:
          path: dist-newstyle
          key: dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }}
          restore-keys: |
            dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-
            dist-${{ runner.os }}-${{ matrix.ghc }}-

      - shell: bash
        run: .github/ci.sh install_system_deps
        env:
          Z3_VERSION: "4.8.7"
          CVC4_VERSION: "4.1.8"
          YICES_VERSION: "2.6.2"

      - shell: bash
        run: .github/ci.sh setup_external_tools

      - shell: bash
        run: .github/ci.sh build

      - shell: bash
        run: .github/ci.sh test_dist

      - if: >-
          (startsWith(github.head_ref, 'releases-')
            || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/')))
          && matrix.ghc == '8.10.1'
        uses: actions/upload-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

  docs:
    runs-on: ubuntu-latest
    needs: [outputs]
    if: >-
      (startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request'
            && startsWith(github.head_ref, 'actions/')))
      || contains(needs.outputs.outputs.changed, 'docs/')
    steps:
      - uses: actions/checkout@v2
      - uses: docker://pandoc/latex:latest
        with:
          args: >-
            sh -c
            "
            apk add make &&
            tlmgr install subfigure lastpage preprint adjustbox nag collectbox sectsty todonotes palatino mathpazo &&
            cd docs &&
            make
            "
      - uses: actions/upload-artifact@v2
        with:
          path: docs
          name: docs

  bundle:
    runs-on: ${{ matrix.os }}
    if: >-
      startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/'))
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        ghc: ["8.10.1"]
    needs: [outputs, docs, build]
    env:
      VERSION: ${{ needs.outputs.outputs.cryptol-version }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/download-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

      - uses: actions/download-artifact@v2
        with:
          path: docs
          name: docs

      - shell: bash
        run: .github/ci.sh bundle_files

      - if: runner.os == 'Windows'
        run: .github/wix.ps1

      - if: runner.os == 'Windows'
        shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh sign cryptol.msi

      - shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh zip_dist

      - uses: actions/upload-artifact@v2
        if: runner.os != 'Windows'
        with:
          name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
          path: "${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64.tar.gz*"

      - uses: actions/upload-artifact@v2
        if: runner.os == 'Windows'
        with:
          name: ${{ needs.outputs.outputs.name }}-${{ runner.os }}-x86_64
          path: "cryptol.msi*"

  release:
    needs: [outputs, bundle]
    if: >-
      startsWith(github.head_ref, 'releases-')
        || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'actions/'))
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: release-drafter/release-drafter@v5
        id: release
        with:
          version: v${{ needs.outputs.outputs.cryptol-version }}
          name: v${{ needs.outputs.outputs.cryptol-version }}
          tag: v${{ needs.outputs.outputs.cryptol-version }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - uses: actions/download-artifact@v2
        with:
          path: artifacts
      - name: Upload artifacts to release
        run: |
          # workaround for draft-releaser being hard to test in CI
          tag="v${VERSION}"
          body="${body:-$tag}"
          if ! hub release show "$tag"; then
            hub release create -d -m "$body" "$tag"
          fi
          assets=()
{'fraction_non_alphanumeric': 0.14821707734683243, 'fraction_numerical': 0.014888706915804363, 'mean_word_length': 1.8264254155270356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '329530', 'n_tokens_mistral': 4547, 'n_tokens_neox': 4261, 'n_words': 905}