From b6762d943d8dee67056222a0ec3922dd21eb98e7 Mon Sep 17 00:00:00 2001 From: Benedikt Schesch Date: Sat, 4 May 2024 21:40:19 -0700 Subject: [PATCH] Added CI/CD file --- .github/workflows/check-reproducibility.yml | 50 +++++++++++++++++++++ src/python/replay_merge.py | 23 +++++++--- 2 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/check-reproducibility.yml diff --git a/.github/workflows/check-reproducibility.yml b/.github/workflows/check-reproducibility.yml new file mode 100644 index 0000000000..bcd32af277 --- /dev/null +++ b/.github/workflows/check-reproducibility.yml @@ -0,0 +1,50 @@ +name: Run Small test +on: [push, pull_request] +jobs: + test: + strategy: + matrix: + maven: [ '3.9.2' ] + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 17 + - run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV + - run: java -version + - uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + python-version: 3.12 + auto-update-conda: true + mamba-version: "*" + channels: conda-forge,defaults + activate-environment: AST + environment-file: environment.yml + - name: Install maven + uses: s4u/setup-maven-action@v1.8.0 + with: + java-version: 17 + maven-version: ${{ matrix.maven }} + - name: Clean caches & workspace + run: make clean + - run: echo "LOGURU_COLORIZE=NO" >> $GITHUB_ENV + - name: Run small test + run: | + git config --global user.email "example@example.com" + git config --global user.name "Example Example" + head -n 101 results/combined/result.csv > results/combined/result_trimmed.csv + make check-merges-reproducibilit + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} diff --git a/src/python/replay_merge.py b/src/python/replay_merge.py index 3aa3561cbc..c7352e44b3 100755 --- a/src/python/replay_merge.py +++ b/src/python/replay_merge.py @@ -3,6 +3,7 @@ """Replay merges and their test results""" import argparse import os +import sys from pathlib import Path import shutil import pandas as pd @@ -75,13 +76,21 @@ def merge_replay( f"workdir {WORKDIR_DIRECTORY/workdir} already exists. Skipping" ) continue - - repo = Repository( - repo_slug, - cache_directory=Path("no_cache/"), - workdir_id=workdir, - delete_workdir=delete_workdir, - ) + try: + repo = Repository( + repo_slug, + cache_directory=Path("no_cache/"), + workdir_id=workdir, + delete_workdir=delete_workdir, + lazy_clone=False, + ) + except Exception as e: + logger.error( + f"Git clone failed for {repo_slug} {merge_data['left']}" + + f"{merge_data['right']} {e}" + ) + # Exit with 0 for CI/CD to not cause problems in case a repo is no longer available + sys.exit(0) ( merge_result, merge_fingerprint,