|
| 1 | +name: Build and Cross-compile |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest] |
| 16 | + compiler: [clang] |
| 17 | + |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + steps: |
| 20 | + - name: Checkout Repository |
| 21 | + uses: actions/checkout@v3 |
| 22 | + with: |
| 23 | + submodules: true |
| 24 | + |
| 25 | + ####################### |
| 26 | + # Ubuntu dependencies # |
| 27 | + ####################### |
| 28 | + - name: Install dependencies (Ubuntu) |
| 29 | + if: matrix.os == 'ubuntu-latest' |
| 30 | + run: | |
| 31 | + sudo apt update |
| 32 | + sudo apt install --no-install-recommends -y build-essential libboost-all-dev libssl-dev git |
| 33 | +
|
| 34 | + - name: Cache build artifacts (Ubuntu) |
| 35 | + if: matrix.os == 'ubuntu-latest' |
| 36 | + uses: actions/cache@v3 |
| 37 | + with: |
| 38 | + path: | |
| 39 | + obj |
| 40 | + libi2pd.a |
| 41 | + key: ubuntu-build-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.h') }} |
| 42 | + |
| 43 | + - name: Install MSYS2 (Windows) |
| 44 | + if: matrix.os == 'windows-latest' |
| 45 | + run: | |
| 46 | + Invoke-WebRequest -Uri "https://github.com/msys2/msys2-installer/releases/download/2025-08-30/msys2-x86_64-20250830.exe" -OutFile "msys2-installer.exe" |
| 47 | + Start-Process -Wait -FilePath "msys2-installer.exe" -ArgumentList "/S" |
| 48 | + C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm" |
| 49 | + C:\msys64\usr\bin\bash.exe -lc "export ARCH=x86_64; export MINGW=mingw64; pacman -S --noconfirm mingw-w64-$ARCH-gcc mingw-w64-$ARCH-boost mingw-w64-$ARCH-openssl git make" |
| 50 | +
|
| 51 | + - name: Initialize Git Submodules |
| 52 | + run: git submodule update --init --recursive |
| 53 | + |
| 54 | + - name: Build Project (Ubuntu) |
| 55 | + if: matrix.os == 'ubuntu-latest' |
| 56 | + run: | |
| 57 | + make -j8 |
| 58 | + make stripall |
| 59 | + make builddir |
| 60 | +
|
| 61 | + - name: Build Project (Windows) |
| 62 | + if: matrix.os == 'windows-latest' |
| 63 | + run: | |
| 64 | + C:\msys64\usr\bin\bash.exe -lc "cd /c/runner/work/i2pd-tools/i2pd-tools && make && make stripall && make builddir" |
| 65 | +
|
| 66 | + - name: Upload binaries |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: my-binaries-${{ matrix.os }} |
| 70 | + path: build/* |
| 71 | + |
0 commit comments