Skip to content

Commit

Permalink
use path filters to determine change set and select tests to run (#3808)
Browse files Browse the repository at this point in the history
Part of  #3800

* Determines change sets using simple directory / file filters
* Skips running kore integration tests if no changes were detected
  • Loading branch information
jberthold authored Apr 15, 2024
1 parent 9b8ebf6 commit d5f0b20
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:

nix-integration:
name: 'Nix / Integration'
needs: formatting
runs-on: [self-hosted, linux, normal]
steps:
- name: Check out code
Expand All @@ -160,15 +161,60 @@ jobs:
name: k-framework
skipPush: true

- name: Run booster integration Tests
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
kore:
- 'kore/**'
kore_rpc_types:
- 'kore-rpc-types/**'
booster:
- 'booster/**'
dev_tools:
- 'dev-tools/**'
project:
- 'stack.yaml*'
- 'cabal.project*'
- 'Makefile'
- '*.mk'
- 'flake.nix'
- 'deps/*'
- scripts/booster-integration-tests.sh
kore_tests:
- 'test/**'
- name: Build
run: GC_DONT_GC=1 nix build .#kore-exec .#kore-rpc-booster

- name: Cache Cabal package database and store
uses: actions/cache@v4
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}-${{ hashFiles('booster/hs-backend-booster.cabal') }}
restore-keys: |
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}
- name: Run unit tests
if: ${{ steps.changes.outputs.booster == 'true' || steps.changes.outputs.kore == 'true' || steps.changes.outputs.project == 'true' }}
run: GC_DONT_GC=1 nix develop .#cabal --command bash -c "cabal update && cabal build all && cabal test --enable-tests --test-show-details=direct kore-test unit-tests"

- name: Run booster integration tests
if: ${{ (steps.changes.outputs.booster == 'true' || steps.changes.outputs.kore_rpc_types == 'true' || steps.changes.outputs.project == 'true') }}
run: |
GC_DONT_GC=1 nix develop .#cabal --command bash -c "scripts/booster-integration-tests.sh"
- name: Run kore integration tests
# FIXME do not run this unless anything has changed in a relevant directory
# see https://github.com/dorny/paths-filter
# do not run this unless anything has changed in a relevant directory
if: ${{ (steps.changes.outputs.kore == 'true' || steps.changes.outputs.kore_rpc_types == 'true' || steps.changes.outputs.kore_tests == 'true' || steps.changes.outputs.project == 'true') }}
run: |
nix develop github:runtimeverification/k/v$(cat deps/k_release)#kore-integration-tests \
GC_DONT_GC=1 nix develop github:runtimeverification/k/v$(cat deps/k_release)#kore-integration-tests \
--override-input haskell-backend . --update-input haskell-backend \
--command bash -c "cd test && make -j2 --output-sync test"
Expand Down

0 comments on commit d5f0b20

Please sign in to comment.