Skip to content

Commit

Permalink
Configure GitHub Actions to run tests with valgrind every night inste…
Browse files Browse the repository at this point in the history
…ad of every pull request (#552)
  • Loading branch information
Akuli authored Jan 5, 2025
1 parent caba667 commit 20f3a30
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 20f3a30

Please sign in to comment.