Skip to content

.github/workflows/valgrind.yml #12

.github/workflows/valgrind.yml

.github/workflows/valgrind.yml #12

Workflow file for this run

# Runs tests with valgrind. That catches various memory bugs, but is too slow
# for running in every pull request.
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch: # Can also be triggered manually from github UI
jobs:
valgrind:
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
matrix:
llvm-version: [11, 13, 14]
# Testing all levels because there was a bug that only happened with -O1. (#224)
opt-level: ['-O0', '-O1', '-O2', '-O3']
fail-fast: false
steps:
- uses: actions/checkout@v3
# 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'
name: "Test stage1 compiler with valgrind"
run: ./runtests.sh --verbose --valgrind --jou-flags "${{ matrix.opt-level }}" --stage1
- if: env.recent_commits == 'true'
name: "Test stage2 compiler with valgrind"
run: ./runtests.sh --verbose --valgrind --jou-flags "${{ matrix.opt-level }}" --stage2
- if: env.recent_commits == 'true'
name: "Test stage3 compiler with valgrind"
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:
name: Create an issue if valgrind failed
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [valgrind]
if: ${{ github.repository == 'Akuli/jou' && always() && github.event_name == 'schedule' && needs.valgrind.result == 'failure' }}
permissions:
issues: write
steps:
- run: |
echo "Checking if there is already an issue about valgrind errors..."
if curl -s 'https://api.github.com/repos/${{ github.repository }}/issues?state=open' | jq '.[].title' | grep "Running tests with valgrind failed"; then
echo "There is already an open issue about the valgrind errors. Not creating a new one."
else
echo "No open issue found, creating a new one."
curl -s -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues \
-d '{"title": "Running tests with valgrind failed", "body": "Valgrind output is here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}'
fi