|
| 1 | +name: Build and Diff Projects |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - reproducible |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - reproducible |
| 12 | + |
| 13 | +jobs: |
| 14 | + build_and_compare: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v2 |
| 23 | + with: |
| 24 | + python-version: '3.x' # Adjust to the version you need |
| 25 | + |
| 26 | + - name: Copy source files to two separate folders |
| 27 | + run: | |
| 28 | + # Copy source files into two separate folders |
| 29 | + mkdir ../buildA ../buildA_extended |
| 30 | + # Copy the repo contents into both |
| 31 | + cp -r "$(pwd)" ../buildA |
| 32 | + cp -r "$(pwd)" ../buildA_extended |
| 33 | +
|
| 34 | + echo "Present Directory : `pwd`" |
| 35 | + echo "work contents : `ls ..`" |
| 36 | +
|
| 37 | + - name: Build source 1 |
| 38 | + run: | |
| 39 | + echo "Repo storage available: `df -h .`" |
| 40 | + cd ../buildA |
| 41 | + SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) |
| 42 | + $SOURCE_DIR/configure --set rust.channel=nightly |
| 43 | + $SOURCE_DIR/x.py build --stage 1 -j8 |
| 44 | +
|
| 45 | + - name: Build source 2 |
| 46 | + run: | |
| 47 | + cd ../buildA_extended |
| 48 | + SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) |
| 49 | + $SOURCE_DIR/configure --set rust.channel=nightly |
| 50 | + $SOURCE_DIR/x.py build --stage 1 -j8 |
| 51 | +
|
| 52 | + - name: Compare builds using git diff |
| 53 | + run: | |
| 54 | + # Go back to the root directory |
| 55 | + cd .. |
| 56 | +
|
| 57 | + # Ensure the directories exist |
| 58 | + if [[ ! -d "buildA" || ! -d "buildA_extended" ]]; then |
| 59 | + echo "Error: Build directories not found!" |
| 60 | + exit 1 |
| 61 | + fi |
| 62 | +
|
| 63 | + # Perform a diff between the two builds |
| 64 | + buildA_stage1=`find buildA/build -name stage1` |
| 65 | + buildA2_stage1=`find buildA_extended/build -name stage1` |
| 66 | + diff -r $buildA_stage1/bin $buildA2_stage1/bin || echo "Differences found!" |
| 67 | +
|
0 commit comments