Explore adding a reproducibility test to rust test infrastructure. #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Diff Projects | |
on: | |
push: | |
branches: | |
- master | |
- reproducible | |
pull_request: | |
branches: | |
- master | |
- reproducible | |
jobs: | |
build_and_compare: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' # Adjust to the version you need | |
- name: Copy source files to two separate folder | |
run: | | |
# Copy source files into two separate folders | |
mkdir ../buildA ../buildA_extended | |
# Copy the repo contents into both | |
cp -r "$(pwd)" ../buildA | |
cp -r "$(pwd)" ../buildA_extended | |
FIRST_SOURCE=`pwd` | |
echo "Present Directory : $FIRST_SOURCE" | |
cd .. | |
echo "work contents : `ls`" | |
rm -rf "$FIRST_SOURCE" | |
- name: Build and store binaries from source 1 | |
run: | | |
cd buildA | |
echo "Repo storage available: `df -h .`" | |
SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) | |
$SOURCE_DIR/configure --set rust.channel=nightly | |
$SOURCE_DIR/x.py build --stage 1 -j$(($(nproc)*2/3)) | |
rm -rf $SOURCE_DIR | |
STAGE1_DIR=`find build -name stage1` | |
cp -r "$STAGE1_DIR" . | |
echo "Contents stage 1 dir : `ls stage1`" | |
rm -rf build | |
cd .. | |
- name: Build and store binaries from source 2 | |
run: | | |
cd buildA_extended | |
echo "Repo storage available: `df -h .`" | |
SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) | |
$SOURCE_DIR/configure --set rust.channel=nightly | |
$SOURCE_DIR/x.py build --stage 1 -j$(($(nproc)*2/3)) | |
rm -rf $SOURCE_DIR | |
STAGE1_DIR=`find build -name stage1` | |
cp -r "$STAGE1_DIR" . | |
echo "Contents stage 1 dir : `ls stage1`" | |
rm -rf build | |
cd .. | |
- name: Compare builds using git diff | |
run: | | |
# Ensure the directories exist | |
if [[ ! -d "buildA" || ! -d "buildA_extended" ]]; then | |
echo "Error: Build directories not found!" | |
exit 1 | |
fi | |
# Perform a diff between the two builds | |
diff -r buildA/stage1 buildA_extended/stage1 || echo "Differences found!" |