|
| 1 | +name: Build and Diff Projects |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + - reproducible |
| 11 | + |
| 12 | +jobs: |
| 13 | + build_and_compare: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Set up Python |
| 21 | + uses: actions/setup-python@v2 |
| 22 | + with: |
| 23 | + python-version: '3.x' # Adjust to the version you need |
| 24 | + |
| 25 | + - name: Build and store buildA binaries |
| 26 | + run: | |
| 27 | + mkdir ../buildA |
| 28 | + cp -r "$(pwd)" ../buildA |
| 29 | + pushd ../buildA |
| 30 | + SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) |
| 31 | + $SOURCE_DIR/configure --set rust.channel=nightly |
| 32 | + $SOURCE_DIR/x.py build --stage 2 -j$(($(nproc)*2/3)) |
| 33 | + rm -rf $SOURCE_DIR |
| 34 | + STAGE2_DIR=`find build -name stage2` |
| 35 | + cp -r "$STAGE2_DIR" . |
| 36 | + echo "Contents stage 2 dir : `ls stage2`" |
| 37 | + rm -rf build |
| 38 | + popd |
| 39 | +
|
| 40 | + - name: Build and store buildA_extended binaries |
| 41 | + run: | |
| 42 | + mkdir ../buildA_extended |
| 43 | + cp -r "$(pwd)" ../buildA_extended |
| 44 | + pushd ../buildA_extended |
| 45 | + SOURCE_DIR=$(dirname $(find . -maxdepth 2 -name x.py)) |
| 46 | + $SOURCE_DIR/configure --set rust.channel=nightly |
| 47 | + $SOURCE_DIR/x.py build --stage 2 -j$(($(nproc)*2/3)) |
| 48 | + rm -rf $SOURCE_DIR |
| 49 | + STAGE2_DIR=`find build -name stage2` |
| 50 | + cp -r "$STAGE2_DIR" . |
| 51 | + echo "Contents stage 2 dir : `ls stage2`" |
| 52 | + rm -rf build |
| 53 | + popd |
| 54 | +
|
| 55 | + - name: Compare builds and archive artifacts |
| 56 | + run: | |
| 57 | + sudo apt-get update |
| 58 | + sudo apt-get install -y diffoscope |
| 59 | + # Ensure the directories exist |
| 60 | + if [[ ! -d "../buildA" || ! -d "../buildA_extended" ]]; then |
| 61 | + echo "Error: Build directories not found!" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | +
|
| 65 | + # Perform a diff between the two builds |
| 66 | + diffoscope ../buildA/stage2 ../buildA_extended/stage2 > diffoscope_output.txt || echo "Differences found!" |
| 67 | +
|
| 68 | + tar -czf buildA.tar.gz ../buildA |
| 69 | + tar -czf buildA_extended.tar.gz ../buildA_extended |
| 70 | +
|
| 71 | + - name: Upload diffoscope output |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: diffoscope-report |
| 75 | + path: diffoscope_output.txt |
| 76 | + |
| 77 | + - name: Upload buildA artifact |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: buildA |
| 81 | + path: buildA.tar.gz |
| 82 | + |
| 83 | + - name: Upload buildA_extended artifact |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: buildA_extended |
| 87 | + path: buildA_extended.tar.gz |
0 commit comments