diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml deleted file mode 100644 index dd73fc23c5..0000000000 --- a/.github/workflows/bench.yml +++ /dev/null @@ -1,208 +0,0 @@ -name: Benchmark - -defaults: - run: - shell: bash - -# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. -concurrency: - group: ${{ github.head_ref }}-${{ github.workflow }} - cancel-in-progress: true - -on: - pull_request: - branches: - - '**' - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v3.4.1 - with: - cancel_others: false - paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "**/test/**", "flake.lock", "**/README.md", "FUNDING.yml"]' - - bench_init: - if: needs.pre_job.outputs.should_skip != 'true' - needs: pre_job - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - ghc: ['8.10.7'] - os: [ubuntu-latest] - cabal: ['3.6'] - - # This code is fitted to the strategy: assumes Linux is used ... etc, - # change of the strategy may require changing the bootstrapping/run code - - steps: - - uses: actions/checkout@v2 - - - run: git fetch origin master # check the master branch for benchmarking - - - uses: haskell/actions/setup@v1 - id: HaskEnvSetup - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - name: Linux Platform config - run: | - echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - # All workflows which distinquishes cache on `cabal.project` needs this. - - name: Workaround shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - - name: Retrieving `cabal.project` Hackage timestamp - run: | - # Form: index-state: 2021-11-29T08:11:08Z - INDEX_STATE_ENTRY=$(grep index-state cabal.project) - # Form: 2021-11-29T08-11-08Z - INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-') - echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV - - - name: Hackage sources cache - uses: actions/cache@v2 - env: - cache-name: hackage-sources - with: - path: ${{ env.CABAL_PKGS_DIR }} - key: ${{ env.cache-name }}-${{ env.INDEX_STATE }} - restore-keys: ${{ env.cache-name }}- - - - name: Compiled deps cache - uses: actions/cache@v2 - env: - cache-name: compiled-deps - with: - path: ${{ steps.HaskEnvSetup.outputs.cabal-store }} - key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project') }} - restore-keys: | - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}- - ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}- - ${{ env.cache-name }}-${{ runner.os }}- - - - run: cabal update - - # max-backjumps is increased as a temporary solution - # for dependency resolution failure - - run: cabal configure --enable-benchmarks --max-backjumps 12000 - - - name: Build - run: cabal build ghcide:benchHist - - - name: Bench init - run: cabal bench ghcide:benchHist -j --benchmark-options="all-binaries" - - # tar is required to preserve file permissions - # compression speeds up upload/download nicely - - name: tar workspace - run: tar -czf workspace.tar.gz * .git - - - name: tar cabal - run: | - cd ~/.cabal - tar -czf cabal.tar.gz * - - - name: Upload workspace - uses: actions/upload-artifact@v2 - with: - name: workspace - retention-days: 1 - path: workspace.tar.gz - - - name: Upload .cabal - uses: actions/upload-artifact@v2 - with: - name: cabal-home - retention-days: 1 - path: ~/.cabal/cabal.tar.gz - - bench_example: - needs: [bench_init, pre_job] - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - ghc: ['8.10.7'] - os: [ubuntu-latest] - cabal: ['3.6'] - example: ['cabal', 'lsp-types'] - - steps: - - uses: haskell/actions/setup@v1 - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false - - - name: Download cabal home - uses: actions/download-artifact@v2 - with: - name: cabal-home - path: . - - - name: Download workspace - uses: actions/download-artifact@v2 - with: - name: workspace - path: . - - - name: untar - run: | - mkdir -p ~/.cabal - tar xzf workspace.tar.gz - tar xzf cabal.tar.gz --directory ~/.cabal - - - name: Bench - run: cabal bench ghcide:benchHist -j --benchmark-options="${{ matrix.example }}" - - - name: Display results - run: | - column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt - - - name: Archive benchmarking artifacts - uses: actions/upload-artifact@v2 - with: - name: bench-results-${{ runner.os }}-${{ matrix.ghc }} - path: | - ghcide/bench-results/results.* - ghcide/bench-results/**/*.csv - ghcide/bench-results/**/*.svg - ghcide/bench-results/**/*.eventlog.html - - - name: Archive benchmark logs - uses: actions/upload-artifact@v2 - with: - name: bench-logs-${{ runner.os }}-${{ matrix.ghc }} - path: | - ghcide/bench-results/**/*.log - ghcide/bench-results/**/*.eventlog - ghcide/bench-results/**/*.hp - - bench_post_job: - if: always() - runs-on: ubuntu-latest - needs: [pre_job, bench_init, bench_example] - steps: - - run: | - echo "jobs info: ${{ toJSON(needs) }}" - - if: contains(needs.*.result, 'failure') - run: exit 1 - - if: contains(needs.*.result, 'cancelled') - name: cancelling - uses: andymckay/cancel-action@0.2