Compare win/linux builds #133
This file contains 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 | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
push: | |
paths: | |
- ".github/workflows/build.yaml" | |
- "src/**/*" | |
pull_request: | |
paths: | |
- "src/**/*" | |
env: | |
SDCC_VERSION: 4.4.0 | |
jobs: | |
Build_Windows: | |
runs-on: windows-latest | |
steps: | |
- name: install SDCC | |
run: | #install silent and then unpack missing installation libraries | |
Invoke-WebRequest https://altushost-swe.dl.sourceforge.net/project/sdcc/sdcc-win64/4.2.0/sdcc-4.2.0-x64-setup.exe -OutFile sdcc_setup.exe | |
Start-Process -wait -FilePath "sdcc_setup.exe" -ArgumentList "/S", "/D=C:\Program Files\SDCC" | |
echo "Adding sdcc to PATH" | |
Add-Content $env:GITHUB_PATH "C:\Program Files\SDCC\bin" | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
cd src/controller | |
../../tools/cygwin/bin/make.exe clean | |
../../tools/cygwin/bin/make.exe CFLAGS=--Werror | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: firmware_from_windows | |
path: bin/main.ihx | |
Build_Linux: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: install SDCC | |
run: | | |
cd ~ | |
wget https://altushost-swe.dl.sourceforge.net/project/sdcc/sdcc-linux-amd64/$SDCC_VERSION/sdcc-$SDCC_VERSION-amd64-unknown-linux2.5.tar.bz2 | |
sudo tar xf sdcc-$SDCC_VERSION-amd64-unknown-linux2.5.tar.bz2 | |
cd sdcc-$SDCC_VERSION/ | |
sudo cp -r * /usr/local | |
sdcc --version | |
sdcc --print-search-dirs | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
cd src/controller | |
make clean | |
make CFLAGS=--Werror | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: firmware_from_linux | |
path: bin/main.ihx | |
Compare_builds: | |
needs: [Build_Windows, Build_Linux] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download Windows build | |
uses: actions/download-artifact@v4 | |
with: | |
name: firmware_from_windows | |
path: firmware_from_windows | |
- run: unzip firmware_from_windows.zip | |
- name: Download Linux build | |
uses: actions/download-artifact@v4 | |
with: | |
name: firmware_from_linux | |
path: firmware_from_linux | |
- run: unzip firmware_from_linux.zip | |
- name: Compare output files | |
run: | | |
ls -l | |
echo "Comparing build files" | |
cat firmware_from_windows/main.ihx | |
cat firmware_from_linux/main.ihx | |
diff -u <(cat firmware_from_windows/main.ihx) <(cat firmware_from_linux/main.ihx) | |
if [ $? -eq 0 ]; then | |
echo "Builds are identical" | |
else | |
echo "Builds are different" | |
exit 1 |