From 71f25b89f288aa21bb06b61ebabedcb87e08b2ca Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 1 Apr 2021 23:55:17 +0200 Subject: [PATCH 1/3] Skip individual steps --- .github/workflows/bench.yml | 72 ++++++++++++++++++++-------------- .github/workflows/test.yml | 77 +++++++++++++++++++------------------ 2 files changed, 83 insertions(+), 66 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3eb9c7afa8..02110844f9 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -19,7 +19,6 @@ jobs: bench-init: needs: pre_job - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ${{ matrix.os }} strategy: @@ -29,18 +28,21 @@ jobs: os: [ubuntu-latest] steps: - # Cancel queued workflows from earlier commits in this branch - - uses: fkirc/skip-duplicate-actions@master - - - uses: actions/checkout@v2 - - run: git fetch origin master # check the master branch for benchmarking - - uses: haskell/actions/setup@v1 + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + run: exit 0 + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + uses: actions/checkout@v2 + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + run: git fetch origin master # check the master branch for benchmarking + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} cabal-version: '3.2' enable-stack: false - - name: Cache Cabal + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Cache Cabal uses: actions/cache@v2 with: path: | @@ -52,37 +54,45 @@ jobs: v2-${{ runner.os }}-${{ matrix.ghc }}-bench- v2-${{ runner.os }}-${{ matrix.ghc }} - - run: cabal update + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + run: cabal update - - run: cabal configure --enable-benchmarks + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + run: cabal configure --enable-benchmarks - - name: Build + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Build shell: bash run: cabal build ghcide:benchHist - - name: Bench init + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Bench init shell: bash 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 + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: tar workspace shell: bash run: tar -czf workspace.tar.gz * .git - - name: tar cabal + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: tar cabal run: | cd ~/.cabal tar -czf cabal.tar.gz * - - name: Upload workspace + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Upload workspace uses: actions/upload-artifact@v2 with: name: workspace retention-days: 1 path: workspace.tar.gz - - name: Upload .cabal + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Upload .cabal uses: actions/upload-artifact@v2 with: name: cabal-home @@ -90,8 +100,7 @@ jobs: path: ~/.cabal/cabal.tar.gz bench-example: - needs: [pre_job, bench-init] - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + needs: [bench-init, pre_job] runs-on: ${{ matrix.os }} strategy: @@ -102,42 +111,46 @@ jobs: example: ['Cabal-3.0.0.0', 'lsp-types-1.0.0.1'] steps: - # Cancel queued workflows from earlier commits in this branch - - uses: fkirc/skip-duplicate-actions@master - - - uses: haskell/actions/setup@v1 + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} cabal-version: '3.2' enable-stack: false - - name: Download cabal home + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Download cabal home uses: actions/download-artifact@v2 with: name: cabal-home path: . - - name: Download workspace + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Download workspace uses: actions/download-artifact@v2 with: name: workspace path: . - - name: untar + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: untar run: | tar xzf workspace.tar.gz tar xzf cabal.tar.gz --directory ~/.cabal - - name: Bench + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Bench shell: bash run: cabal bench ghcide:benchHist -j --benchmark-options="${{ matrix.example }}" - - name: Display results + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Display results shell: bash 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 + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Archive benchmarking artifacts uses: actions/upload-artifact@v2 with: name: bench-results-${{ runner.os }}-${{ matrix.ghc }} @@ -147,7 +160,8 @@ jobs: ghcide/bench-results/**/*.svg ghcide/bench-results/**/*.eventlog.html - - name: Archive benchmark logs + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + name: Archive benchmark logs uses: actions/upload-artifact@v2 with: name: bench-logs-${{ runner.os }}-${{ matrix.ghc }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2a563c5af..093025cdf6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,10 +21,7 @@ jobs: cancel_others: true paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**"]' - test: - needs: pre_job - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ${{ matrix.os }} strategy: fail-fast: true @@ -58,33 +55,36 @@ jobs: # ghc: '8.6.4' steps: - # Cancel queued workflows from earlier commits in this branch - - uses: fkirc/skip-duplicate-actions@master - - - uses: actions/checkout@v2 + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + run: exit 0 + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + uses: actions/checkout@v2 with: submodules: true - - uses: haskell/actions/setup@v1 + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} cabal-version: "3.2" - - run: ./fmt.sh + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + run: ./fmt.sh name: "HLint via ./fmt.sh" - - name: Set some window specific things - if: matrix.os == 'windows-latest' + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.os == 'windows-latest'}} + name: Set some window specific things run: | echo "CABAL_STORE_DIR=$SYSTEMDRIVE\\SR" >> $GITHUB_ENV echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV - - name: Set some linux/macOS specific things - if: matrix.os != 'windows-latest' + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.os != 'windows-latest'}} + name: Set some linux/macOS specific things run: | echo "CABAL_STORE_DIR=~/.cabal/store" >> $GITHUB_ENV echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - name: Cache Cabal + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + name: Cache Cabal uses: actions/cache@v2 env: cache-name: cache-cabal @@ -98,10 +98,12 @@ jobs: v2-${{ runner.os }}-${{ matrix.ghc }}-build- v2-${{ runner.os }}-${{ matrix.ghc }} - - run: cabal update + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + run: cabal update # Need this to work around filepath length limits in Windows - - name: Shorten binary names + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + name: Shorten binary names run: | sed -i.bak -e 's/haskell-language-server/hls/g' \ -e 's/haskell_language_server/hls/g' \ @@ -109,17 +111,18 @@ jobs: sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ src/**/*.hs exe/*.hs - - name: Build + - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + name: Build # Retry it three times to workaround compiler segfaults in windows run: cabal build || cabal build || cabal build - - name: Test ghcide - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test ghcide # run the tests without parallelism to avoid running out of memory run: cabal test ghcide --test-options="-j1 --rerun-update" || cabal test ghcide --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test ghcide --test-options="-j1 --rerun" - - name: Test func-test suite - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test func-test suite env: HLS_TEST_EXE: hls HLS_WRAPPER_TEST_EXE: hls-wrapper @@ -128,8 +131,8 @@ jobs: # instances to be spun up for the poor github actions runner to handle run: cabal test func-test --test-options="-j1 --rerun --rerun-update" || cabal test func-test --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test func-test --test-options="-j1 --rerun" - - name: Test wrapper-test suite - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test wrapper-test suite env: HLS_TEST_EXE: hls HLS_WRAPPER_TEST_EXE: hls-wrapper @@ -138,30 +141,30 @@ jobs: # instances to be spun up for the poor github actions runner to handle run: cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" - - name: Test hls-brittany-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-brittany-plugin run: cabal test hls-brittany-plugin || cabal test hls-brittany-plugin --test-options="-j1" - - name: Test hls-class-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-class-plugin run: cabal test hls-class-plugin || cabal test hls-class-plugin --test-options="-j1" - - name: Test hls-eval-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-eval-plugin run: cabal test hls-eval-plugin --test-options="-j1 --rerun" || cabal test hls-eval-plugin --test-options="-j1 --rerun" - - name: Test hls-haddock-comments-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-haddock-comments-plugin run: cabal test hls-haddock-comments-plugin || cabal test hls-haddock-comments-plugin --test-options="-j1" - - name: Test hls-splice-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-splice-plugin run: cabal test hls-splice-plugin || cabal test hls-splice-plugin --test-options="-j1" - - name: Test hls-stylish-haskell-plugin - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-stylish-haskell-plugin run: cabal test hls-stylish-haskell-plugin || cabal test hls-stylish-haskell-plugin --test-options="-j1" - - name: Test hls-tactics-plugin test suite - if: ${{ matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + name: Test hls-tactics-plugin test suite run: LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="-j1" From 1c3b9fa186dc07e880c8c1636c8f880d7f1b73c4 Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 2 Apr 2021 16:04:11 +0200 Subject: [PATCH 2/3] Skip individual steps --- .github/workflows/bench.yml | 4 +--- .github/workflows/test.yml | 42 ++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 02110844f9..41578e6d87 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -12,7 +12,7 @@ jobs: should_skip: ${{ steps.skip_check.outputs.should_skip }} steps: - id: skip_check - uses: fkirc/skip-duplicate-actions@master + uses: fkirc/skip-duplicate-actions@v3.4.0 with: cancel_others: true paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**", "**/test/**"]' @@ -28,8 +28,6 @@ jobs: os: [ubuntu-latest] steps: - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} - run: exit 0 - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} uses: actions/checkout@v2 - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 093025cdf6..d679695980 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: should_skip: ${{ steps.skip_check.outputs.should_skip }} steps: - id: skip_check - uses: fkirc/skip-duplicate-actions@master + uses: fkirc/skip-duplicate-actions@v3.4.0 with: cancel_others: true paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**"]' @@ -55,35 +55,33 @@ jobs: # ghc: '8.6.4' steps: - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} - run: exit 0 - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} uses: actions/checkout@v2 with: submodules: true - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} uses: haskell/actions/setup@v1 with: ghc-version: ${{ matrix.ghc }} cabal-version: "3.2" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} run: ./fmt.sh name: "HLint via ./fmt.sh" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.os == 'windows-latest'}} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.os == 'windows-latest'}} name: Set some window specific things run: | echo "CABAL_STORE_DIR=$SYSTEMDRIVE\\SR" >> $GITHUB_ENV echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.os != 'windows-latest'}} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.os != 'windows-latest'}} name: Set some linux/macOS specific things run: | echo "CABAL_STORE_DIR=~/.cabal/store" >> $GITHUB_ENV echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} name: Cache Cabal uses: actions/cache@v2 env: @@ -98,11 +96,11 @@ jobs: v2-${{ runner.os }}-${{ matrix.ghc }}-build- v2-${{ runner.os }}-${{ matrix.ghc }} - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} run: cabal update # Need this to work around filepath length limits in Windows - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} name: Shorten binary names run: | sed -i.bak -e 's/haskell-language-server/hls/g' \ @@ -111,17 +109,17 @@ jobs: sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ src/**/*.hs exe/*.hs - - if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} name: Build # Retry it three times to workaround compiler segfaults in windows run: cabal build || cabal build || cabal build - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test ghcide # run the tests without parallelism to avoid running out of memory run: cabal test ghcide --test-options="-j1 --rerun-update" || cabal test ghcide --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test ghcide --test-options="-j1 --rerun" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test func-test suite env: HLS_TEST_EXE: hls @@ -131,7 +129,7 @@ jobs: # instances to be spun up for the poor github actions runner to handle run: cabal test func-test --test-options="-j1 --rerun --rerun-update" || cabal test func-test --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test func-test --test-options="-j1 --rerun" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test wrapper-test suite env: HLS_TEST_EXE: hls @@ -141,30 +139,30 @@ jobs: # instances to be spun up for the poor github actions runner to handle run: cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" || cabal test wrapper-test --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-brittany-plugin run: cabal test hls-brittany-plugin || cabal test hls-brittany-plugin --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-class-plugin run: cabal test hls-class-plugin || cabal test hls-class-plugin --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-eval-plugin run: cabal test hls-eval-plugin --test-options="-j1 --rerun" || cabal test hls-eval-plugin --test-options="-j1 --rerun" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-haddock-comments-plugin run: cabal test hls-haddock-comments-plugin || cabal test hls-haddock-comments-plugin --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-splice-plugin run: cabal test hls-splice-plugin || cabal test hls-splice-plugin --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-stylish-haskell-plugin run: cabal test hls-stylish-haskell-plugin || cabal test hls-stylish-haskell-plugin --test-options="-j1" - - if: ${{ needs.pre_job.outputs.should_skip == 'true' && matrix.test }} + - if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }} name: Test hls-tactics-plugin test suite run: LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="-j1" From 3eddabf804b4a09ea07cff26f5470514b1639f50 Mon Sep 17 00:00:00 2001 From: jneira Date: Fri, 2 Apr 2021 23:53:15 +0200 Subject: [PATCH 3/3] And needs pre_job --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d679695980..a11f0fdccc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "nix/**"]' test: + needs: pre_job runs-on: ${{ matrix.os }} strategy: fail-fast: true