<commit_before>name: SAWScript
on:
  push:
    tags: ["v?[0-9]+.[0-9]+(.[0-9]+)?"]
    branches: [master, "release-**"]
  pull_request:
  schedule:
    - cron: "0 10 * * *" # 10am UTC -> 2/3am PST
  workflow_dispatch:

env:
  CACHE_VERSION: 1

  # Solver versions - also update in the following locations:
  # ./saw/Dockerfile
  # ./saw-remote-api/Dockerfile
  # ./s2nTests/docker/saw.dockerfile
  Z3_VERSION: "4.8.10"
  CVC4_VERSION: "4.1.8"
  YICES_VERSION: "2.6.2"

  OCAML_VERSION: 4.09.x

jobs:
  config:
    runs-on: ubuntu-latest
    outputs:
      name: ${{ steps.config.outputs.name }}
      version: ${{ steps.config.outputs.version }}
      event-tag: ${{ steps.config.outputs.tag }}
      event-schedule: ${{ steps.config.outputs.schedule }}
      publish: ${{ steps.config.outputs.publish }}
      release: ${{ steps.config.outputs.release }}
      retention-days: ${{ steps.config.outputs.retention-days }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: config
        id: config
        env:
          EVENT_TAG: ${{ startsWith(github.event.ref, 'refs/tags/') }}
          EVENT_SCHEDULE: ${{ github.event_name == 'schedule' }}
          EVENT_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
          RELEASE: ${{ startsWith(github.event.ref, 'refs/heads/release-') }}
        run: |
          set -x
          .github/ci.sh output name saw-$(.github/ci.sh ver)
          .github/ci.sh output version $(.github/ci.sh ver)
          .github/ci.sh output tag $EVENT_TAG
          .github/ci.sh output schedule $EVENT_SCHEDULE
          .github/ci.sh output publish $({ $EVENT_TAG || $EVENT_SCHEDULE; } && echo true || echo false)
          .github/ci.sh output release $([[ "refs/heads/release-$(.github/ci.sh ver)" == "${{ github.event.ref }}" ]] && echo true || echo false)
          .github/ci.sh output retention-days $($RELEASE && echo 90 || echo 5)

  build:
    runs-on: ${{ matrix.os }}
    needs: [config]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-18.04, macos-latest, windows-latest]
        ghc: ["8.8.4", "8.10.3"]
        exclude:
          - os: windows-latest
            ghc: "8.8.4"
    outputs:
      cabal-test-suites-json: ${{ steps.cabal-test-suites.outputs.targets-json }}
    steps:

      - uses: actions/checkout@v2
      - run: |
          git submodule update --init
          git -C deps/abcBridge submodule update --init

      - id: config
        shell: bash
        run: |
          NAME="${{ needs.config.outputs.name }}-${{ runner.os }}-x86_64"
          .github/ci.sh output name $NAME
          echo "NAME=${{ needs.config.outputs.name }}-${{ runner.os }}-x86_64" >> $GITHUB_ENV

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

      - uses: actions/cache@v2
        name: Cache cabal store
        with:
          path: |
            ${{ steps.setup-haskell.outputs.cabal-store }}
            dist-newstyle
          key: ${{ env.CACHE_VERSION }}-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
          restore-keys: |
            ${{ env.CACHE_VERSION }}-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-

      - if: needs.config.outputs.release == 'true'
        shell: bash
        run: |
          sed -i.bak \
            -e 's/^hashText = .*$/hashText = ""/' \
            -e '/import GitRev.*$/d' \
            saw/SAWScript/Version.hs
          rm -f saw/SAWScript/Version.hs.bak

      - id: abc
        shell: bash
        run: .github/ci.sh build_abc
        if: runner.os != 'Windows'

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

      - uses: GaloisInc/.github/actions/cabal-collect-bins@v1
        id: cabal-test-suites
        with:
          targets: |
            integration_tests
            cryptol-saw-core-tc-test
          dest: dist-tests

      - if: |
          matrix.ghc == '8.8.4' &&
          runner.os != 'Windows'
        uses: actions/upload-artifact@v2
        with:
          path: ${{ steps.abc.outputs.path }}
          name: abc-${{ runner.os }}

      - uses: actions/upload-artifact@v2
        if: "matrix.ghc == '8.8.4'"
        with:
          path: dist-tests
          name: dist-tests-${{ matrix.os }}

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

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

      - shell: bash
        run: .github/ci.sh zip_dist $NAME

      - if: matrix.ghc == '8.8.4' && needs.config.outputs.release == 'true'
        shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh sign $NAME.tar.gz

      - if: matrix.ghc == '8.8.4'
        uses: actions/upload-artifact@v2
        with:
          name: ${{ steps.config.outputs.name }} (GHC ${{ matrix.ghc }})
          path: "${{ steps.config.outputs.name }}.tar.gz*"
          if-no-files-found: error
          retention-days: ${{ needs.config.outputs.retention-days }}

      - if: "matrix.ghc == '8.8.4'"
        uses: actions/upload-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

      - if: "matrix.os == 'ubuntu-18.04'"
        uses: actions/upload-artifact@v2
        with:
          name: "saw-${{ runner.os }}-${{ matrix.ghc }}"
          path: "dist/bin/saw"

  heapster-tests:
    needs: [build]
    strategy:
      fail-fast: false<commit_msg>Use GHC 8.10 builds as the base for later steps<commit_after>name: SAWScript
on:
  push:
    tags: ["v?[0-9]+.[0-9]+(.[0-9]+)?"]
    branches: [master, "release-**"]
  pull_request:
  schedule:
    - cron: "0 10 * * *" # 10am UTC -> 2/3am PST
  workflow_dispatch:

env:
  CACHE_VERSION: 1

  # Solver versions - also update in the following locations:
  # ./saw/Dockerfile
  # ./saw-remote-api/Dockerfile
  # ./s2nTests/docker/saw.dockerfile
  Z3_VERSION: "4.8.10"
  CVC4_VERSION: "4.1.8"
  YICES_VERSION: "2.6.2"

  OCAML_VERSION: 4.09.x

jobs:
  config:
    runs-on: ubuntu-latest
    outputs:
      name: ${{ steps.config.outputs.name }}
      version: ${{ steps.config.outputs.version }}
      event-tag: ${{ steps.config.outputs.tag }}
      event-schedule: ${{ steps.config.outputs.schedule }}
      publish: ${{ steps.config.outputs.publish }}
      release: ${{ steps.config.outputs.release }}
      retention-days: ${{ steps.config.outputs.retention-days }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: config
        id: config
        env:
          EVENT_TAG: ${{ startsWith(github.event.ref, 'refs/tags/') }}
          EVENT_SCHEDULE: ${{ github.event_name == 'schedule' }}
          EVENT_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
          RELEASE: ${{ startsWith(github.event.ref, 'refs/heads/release-') }}
        run: |
          set -x
          .github/ci.sh output name saw-$(.github/ci.sh ver)
          .github/ci.sh output version $(.github/ci.sh ver)
          .github/ci.sh output tag $EVENT_TAG
          .github/ci.sh output schedule $EVENT_SCHEDULE
          .github/ci.sh output publish $({ $EVENT_TAG || $EVENT_SCHEDULE; } && echo true || echo false)
          .github/ci.sh output release $([[ "refs/heads/release-$(.github/ci.sh ver)" == "${{ github.event.ref }}" ]] && echo true || echo false)
          .github/ci.sh output retention-days $($RELEASE && echo 90 || echo 5)

  build:
    runs-on: ${{ matrix.os }}
    needs: [config]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-18.04, macos-latest, windows-latest]
        ghc: ["8.8.4", "8.10.3"]
        exclude:
          - os: windows-latest
            ghc: "8.8.4"
    outputs:
      cabal-test-suites-json: ${{ steps.cabal-test-suites.outputs.targets-json }}
    steps:

      - uses: actions/checkout@v2
      - run: |
          git submodule update --init
          git -C deps/abcBridge submodule update --init

      - id: config
        shell: bash
        run: |
          NAME="${{ needs.config.outputs.name }}-${{ runner.os }}-x86_64"
          .github/ci.sh output name $NAME
          echo "NAME=${{ needs.config.outputs.name }}-${{ runner.os }}-x86_64" >> $GITHUB_ENV

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

      - uses: actions/cache@v2
        name: Cache cabal store
        with:
          path: |
            ${{ steps.setup-haskell.outputs.cabal-store }}
            dist-newstyle
          key: ${{ env.CACHE_VERSION }}-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-${{ github.sha }}
          restore-keys: |
            ${{ env.CACHE_VERSION }}-cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc)) }}-

      - if: needs.config.outputs.release == 'true'
        shell: bash
        run: |
          sed -i.bak \
            -e 's/^hashText = .*$/hashText = ""/' \
            -e '/import GitRev.*$/d' \
            saw/SAWScript/Version.hs
          rm -f saw/SAWScript/Version.hs.bak

      - id: abc
        shell: bash
        run: .github/ci.sh build_abc
        if: runner.os != 'Windows'

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

      - uses: GaloisInc/.github/actions/cabal-collect-bins@v1
        id: cabal-test-suites
        with:
          targets: |
            integration_tests
            cryptol-saw-core-tc-test
          dest: dist-tests

      - if: |
          matrix.ghc == '8.10.3' &&
          runner.os != 'Windows'
        uses: actions/upload-artifact@v2
        with:
          path: ${{ steps.abc.outputs.path }}
          name: abc-${{ runner.os }}

      - uses: actions/upload-artifact@v2
        if: "matrix.ghc == '8.10.3'"
        with:
          path: dist-tests
          name: dist-tests-${{ matrix.os }}

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

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

      - shell: bash
        run: .github/ci.sh zip_dist $NAME

      - if: matrix.ghc == '8.10.3' && needs.config.outputs.release == 'true'
        shell: bash
        env:
          SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
          SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
        run: .github/ci.sh sign $NAME.tar.gz

      - if: matrix.ghc == '8.10.3'
        uses: actions/upload-artifact@v2
        with:
          name: ${{ steps.config.outputs.name }} (GHC ${{ matrix.ghc }})
          path: "${{ steps.config.outputs.name }}.tar.gz*"
          if-no-files-found: error
          retention-days: ${{ needs.config.outputs.retention-days }}

      - if: "matrix.ghc == '8.10.3'"
        uses: actions/upload-artifact@v2
        with:
          path: dist/bin
          name: ${{ runner.os }}-bins

      - if: "matrix.os == 'ubuntu-18.04'"
        uses: actions/upload-artifact@v2
        with:
          name: "saw-${{ runner.os }}-${{ matrix.ghc }}"
          path: "dist/bin/saw"

  heapster-tests:
    needs: [build]
    strategy:
      fail-fast: false
{'fraction_non_alphanumeric': 0.16386890487609912, 'fraction_numerical': 0.01616484590105693, 'mean_word_length': 1.8513547733603444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '627291', 'n_tokens_mistral': 4008, 'n_tokens_neox': 3760, 'n_words': 738}