|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + branches: [master] |
| 8 | + # release: |
| 9 | + # types: [published] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-linux: |
| 14 | + name: Build Linux |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + arch: |
| 19 | + - { name: amd64, target: x86_64-linux-gnu, apt: gcc } |
| 20 | + - { |
| 21 | + name: arm64, |
| 22 | + target: aarch64-linux-gnu, |
| 23 | + apt: gcc-aarch64-linux-gnu, |
| 24 | + } |
| 25 | + - { |
| 26 | + name: ppc64le, |
| 27 | + target: powerpc64le-linux-gnu, |
| 28 | + apt: gcc-powerpc64le-linux-gnu, |
| 29 | + } |
| 30 | + - { |
| 31 | + name: s390x, |
| 32 | + target: s390x-linux-gnu, |
| 33 | + apt: gcc-s390x-linux-gnu, |
| 34 | + } |
| 35 | + - { |
| 36 | + name: riscv64, |
| 37 | + target: riscv64-linux-gnu, |
| 38 | + apt: gcc-riscv64-linux-gnu, |
| 39 | + } |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Install cross-compilation toolchain |
| 46 | + run: | |
| 47 | + sudo apt-get update |
| 48 | + sudo apt-get install -y ${{ matrix.arch.apt }} |
| 49 | +
|
| 50 | + - name: Build all & vlmcsdmulti |
| 51 | + run: | |
| 52 | + if [ "${{ matrix.arch.name }}" = "amd64" ]; then |
| 53 | + # Native build for amd64 |
| 54 | + make clean |
| 55 | + make all vlmcsdmulti STRIP=0 |
| 56 | + else |
| 57 | + # Cross-compilation for other architectures |
| 58 | + make clean |
| 59 | + make all vlmcsdmulti CC=${{ matrix.arch.target }}-gcc STRIP=0 |
| 60 | + fi |
| 61 | +
|
| 62 | + - name: Prepare artifacts |
| 63 | + run: | |
| 64 | + mkdir -p artifacts/linux-${{ matrix.arch.name }} |
| 65 | + cp -r bin artifacts/linux-${{ matrix.arch.name }} |
| 66 | + cp -r lib artifacts/linux-${{ matrix.arch.name }} |
| 67 | +
|
| 68 | + - name: Upload Linux artifacts |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: vlmcsd-linux-${{ matrix.arch.name }} |
| 72 | + path: artifacts/linux-${{ matrix.arch.name }}/ |
| 73 | + retention-days: 30 |
| 74 | + |
| 75 | + build-windows: |
| 76 | + name: Build Windows |
| 77 | + runs-on: ubuntu-latest |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + arch: |
| 81 | + - { |
| 82 | + name: amd64, |
| 83 | + target: x86_64-w64-mingw32, |
| 84 | + apt: gcc-mingw-w64-x86-64, |
| 85 | + } |
| 86 | + - { |
| 87 | + name: x86, |
| 88 | + target: i686-w64-mingw32, |
| 89 | + apt: gcc-mingw-w64-i686, |
| 90 | + } |
| 91 | + |
| 92 | + steps: |
| 93 | + - name: Checkout code |
| 94 | + uses: actions/checkout@v4 |
| 95 | + |
| 96 | + - name: Install MinGW cross-compilation toolchain |
| 97 | + run: | |
| 98 | + sudo apt-get update |
| 99 | + sudo apt-get install -y ${{ matrix.arch.apt }} |
| 100 | +
|
| 101 | + - name: Build all & vlmcsdmulti for Windows |
| 102 | + run: | |
| 103 | + make clean |
| 104 | + make all vlmcsdmulti CC=${{ matrix.arch.target }}-gcc STRIP=0 |
| 105 | +
|
| 106 | + - name: Prepare artifacts |
| 107 | + run: | |
| 108 | + mkdir -p artifacts/windows-${{ matrix.arch.name }} |
| 109 | + cp -r bin artifacts/windows-${{ matrix.arch.name }} |
| 110 | + cp -r lib artifacts/windows-${{ matrix.arch.name }} |
| 111 | +
|
| 112 | + - name: Upload Windows artifacts |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: vlmcsd-windows-${{ matrix.arch.name }} |
| 116 | + path: artifacts/windows-${{ matrix.arch.name }}/ |
| 117 | + retention-days: 30 |
| 118 | + |
| 119 | + # release: |
| 120 | + # name: Create Release Assets |
| 121 | + # runs-on: ubuntu-latest |
| 122 | + # needs: [build-linux, build-windows] |
| 123 | + # if: github.event_name == 'release' |
| 124 | + |
| 125 | + # steps: |
| 126 | + # - name: Download all artifacts |
| 127 | + # uses: actions/download-artifact@v4 |
| 128 | + # with: |
| 129 | + # path: artifacts/ |
| 130 | + |
| 131 | + # - name: Create release archives |
| 132 | + # run: | |
| 133 | + # cd artifacts/ |
| 134 | + # for dir in */; do |
| 135 | + # archive_name="${dir%/}.tar.gz" |
| 136 | + # tar -czf "../$archive_name" -C "$dir" . |
| 137 | + # done |
| 138 | + # cd .. |
| 139 | + # ls -la *.tar.gz |
| 140 | + |
| 141 | + # - name: Upload release assets |
| 142 | + # uses: softprops/action-gh-release@v1 |
| 143 | + # with: |
| 144 | + # files: | |
| 145 | + # *.tar.gz |
| 146 | + # env: |
| 147 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments