From 20f3a30f02dfd5a398aa8dbee04ff9a3b90d9248 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 5 Jan 2025 14:23:34 +0200 Subject: [PATCH] Configure GitHub Actions to run tests with valgrind every night instead of every pull request (#552) --- .github/workflows/linux.yml | 17 +---------------- .github/workflows/valgrind.yml | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5211610b..bcfd03b3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -21,25 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt update - - run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make valgrind + - run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make - run: LLVM_CONFIG=llvm-config-${{ matrix.llvm-version }} make - run: ./runtests.sh --verbose --jou-flags "${{ matrix.opt-level }}" - run: ./runtests.sh --verbose --jou-flags "${{ matrix.opt-level }} --verbose" - # Valgrinding is slow, but many files affect valgrind results. - # We skip it when all changes are to .md files (docs, README etc) - - name: Figure out if we need to run tests with valgrind - id: check-need-valgrind - run: | - git fetch https://github.com/Akuli/jou main - # Find modified non-markdown files. If there are any, set doit=yes. - if git diff --name-only FETCH_HEAD HEAD | grep -vE '\.md$'; then - echo doit=yes >> $GITHUB_OUTPUT - else - echo doit=no >> $GITHUB_OUTPUT - fi - - if: ${{ steps.check-need-valgrind.outputs.doit == 'yes' }} - run: ./runtests.sh --verbose --valgrind --jou-flags "${{ matrix.opt-level }}" - # valgrind+verbose isn't meaningful: test script would ignore valgrind output - run: make clean - name: Check that "make clean" deleted all files not committed to Git run: | diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 23d80138..a3e431fe 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -16,12 +16,28 @@ jobs: opt-level: ['-O0', '-O1', '-O2', '-O3'] steps: - uses: actions/checkout@v3 - - run: sudo apt update - - run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make valgrind - - run: LLVM_CONFIG=llvm-config-${{ matrix.llvm-version }} make - #- run: ./runtests.sh --verbose --valgrind --jou-flags "${{ matrix.opt-level }}" - - run: echo "Valgrinding... Brrr..." - - run: cat oh no this command will error + + # Do not valgrind when there's nothing new to valgrind in the repo + - name: Check if there was any commits within the last 24 hours + run: | + if git --no-pager log --oneline --since="24 hours ago" --exit-code; then + echo "No commits, will not run valgrind" + echo "recent_commits=false" >> $GITHUB_ENV + else + echo "recent_commits=true" >> $GITHUB_ENV + fi + + - if: env.recent_commits == 'true' + run: sudo apt update + + - if: env.recent_commits == 'true' + run: sudo apt install -y llvm-${{ matrix.llvm-version }}-dev clang-${{ matrix.llvm-version }} make valgrind + + - if: env.recent_commits == 'true' + run: LLVM_CONFIG=llvm-config-${{ matrix.llvm-version }} make + + - if: env.recent_commits == 'true' + run: ./runtests.sh --verbose --valgrind --jou-flags "${{ matrix.opt-level }}" # Based on: https://github.com/python/typeshed/blob/9f28171658b9ca6c32a7cb93fbb99fc92b17858b/.github/workflows/daily.yml create-issue-on-failure: