|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Tag to build (e.g., v0.1.1)' |
| 11 | + required: true |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-linux: |
| 18 | + name: Linux ${{ matrix.variant }} |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - variant: cpu |
| 24 | + features: "" |
| 25 | + suffix: "-cpu" |
| 26 | + - variant: cuda |
| 27 | + features: "--features cuda" |
| 28 | + suffix: "-cuda" |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Install system dependencies |
| 34 | + run: | |
| 35 | + sudo apt-get update |
| 36 | + sudo apt-get install -y \ |
| 37 | + libxkbcommon-dev \ |
| 38 | + libwayland-dev \ |
| 39 | + libxcb-render0-dev \ |
| 40 | + libxcb-shape0-dev \ |
| 41 | + libxcb-xfixes0-dev \ |
| 42 | + libgtk-3-dev \ |
| 43 | + libssl-dev \ |
| 44 | + pkg-config |
| 45 | +
|
| 46 | + - name: Install CUDA toolkit |
| 47 | + if: matrix.variant == 'cuda' |
| 48 | + uses: Jimver/cuda-toolkit@v0.2.16 |
| 49 | + with: |
| 50 | + cuda: '12.5.0' |
| 51 | + method: 'network' |
| 52 | + sub-packages: '["nvcc", "cudart"]' |
| 53 | + |
| 54 | + - uses: dtolnay/rust-toolchain@stable |
| 55 | + |
| 56 | + - uses: Swatinem/rust-cache@v2 |
| 57 | + with: |
| 58 | + key: linux-${{ matrix.variant }} |
| 59 | + |
| 60 | + - name: Build WaveSim |
| 61 | + run: cargo build -p ringkernel-wavesim --release ${{ matrix.features }} |
| 62 | + |
| 63 | + - name: Build TxMon |
| 64 | + run: cargo build -p ringkernel-txmon --release ${{ matrix.features }} |
| 65 | + |
| 66 | + - name: Build AccNet |
| 67 | + run: cargo build -p ringkernel-accnet --release ${{ matrix.features }} |
| 68 | + |
| 69 | + - name: Build ProcInt |
| 70 | + run: cargo build -p ringkernel-procint --release ${{ matrix.features }} |
| 71 | + |
| 72 | + - name: Package binaries |
| 73 | + run: | |
| 74 | + mkdir -p dist |
| 75 | + cp target/release/wavesim dist/wavesim${{ matrix.suffix }} |
| 76 | + cp target/release/txmon dist/txmon${{ matrix.suffix }} |
| 77 | + cp target/release/accnet dist/accnet${{ matrix.suffix }} |
| 78 | + cp target/release/procint dist/procint${{ matrix.suffix }} |
| 79 | +
|
| 80 | + # Create archive |
| 81 | + cd dist |
| 82 | + tar -czvf ../ringkernel-showcase-linux-x86_64${{ matrix.suffix }}.tar.gz * |
| 83 | +
|
| 84 | + - name: Upload artifacts |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: linux${{ matrix.suffix }} |
| 88 | + path: ringkernel-showcase-linux-x86_64${{ matrix.suffix }}.tar.gz |
| 89 | + |
| 90 | + build-windows: |
| 91 | + name: Windows ${{ matrix.variant }} |
| 92 | + runs-on: windows-latest |
| 93 | + strategy: |
| 94 | + matrix: |
| 95 | + include: |
| 96 | + - variant: cpu |
| 97 | + features: "" |
| 98 | + suffix: "-cpu" |
| 99 | + - variant: cuda |
| 100 | + features: "--features cuda" |
| 101 | + suffix: "-cuda" |
| 102 | + |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + |
| 106 | + - name: Install CUDA toolkit |
| 107 | + if: matrix.variant == 'cuda' |
| 108 | + uses: Jimver/cuda-toolkit@v0.2.16 |
| 109 | + with: |
| 110 | + cuda: '12.5.0' |
| 111 | + method: 'network' |
| 112 | + sub-packages: '["nvcc", "cudart"]' |
| 113 | + |
| 114 | + - uses: dtolnay/rust-toolchain@stable |
| 115 | + |
| 116 | + - uses: Swatinem/rust-cache@v2 |
| 117 | + with: |
| 118 | + key: windows-${{ matrix.variant }} |
| 119 | + |
| 120 | + - name: Build WaveSim |
| 121 | + run: cargo build -p ringkernel-wavesim --release ${{ matrix.features }} |
| 122 | + |
| 123 | + - name: Build TxMon |
| 124 | + run: cargo build -p ringkernel-txmon --release ${{ matrix.features }} |
| 125 | + |
| 126 | + - name: Build AccNet |
| 127 | + run: cargo build -p ringkernel-accnet --release ${{ matrix.features }} |
| 128 | + |
| 129 | + - name: Build ProcInt |
| 130 | + run: cargo build -p ringkernel-procint --release ${{ matrix.features }} |
| 131 | + |
| 132 | + - name: Package binaries |
| 133 | + shell: pwsh |
| 134 | + run: | |
| 135 | + New-Item -ItemType Directory -Force -Path dist |
| 136 | + Copy-Item target/release/wavesim.exe dist/wavesim${{ matrix.suffix }}.exe |
| 137 | + Copy-Item target/release/txmon.exe dist/txmon${{ matrix.suffix }}.exe |
| 138 | + Copy-Item target/release/accnet.exe dist/accnet${{ matrix.suffix }}.exe |
| 139 | + Copy-Item target/release/procint.exe dist/procint${{ matrix.suffix }}.exe |
| 140 | +
|
| 141 | + # Create archive |
| 142 | + Compress-Archive -Path dist/* -DestinationPath ringkernel-showcase-windows-x86_64${{ matrix.suffix }}.zip |
| 143 | +
|
| 144 | + - name: Upload artifacts |
| 145 | + uses: actions/upload-artifact@v4 |
| 146 | + with: |
| 147 | + name: windows${{ matrix.suffix }} |
| 148 | + path: ringkernel-showcase-windows-x86_64${{ matrix.suffix }}.zip |
| 149 | + |
| 150 | + release: |
| 151 | + name: Create Release |
| 152 | + needs: [build-linux, build-windows] |
| 153 | + runs-on: ubuntu-latest |
| 154 | + permissions: |
| 155 | + contents: write |
| 156 | + |
| 157 | + steps: |
| 158 | + - name: Download all artifacts |
| 159 | + uses: actions/download-artifact@v4 |
| 160 | + with: |
| 161 | + path: artifacts |
| 162 | + |
| 163 | + - name: List artifacts |
| 164 | + run: find artifacts -type f |
| 165 | + |
| 166 | + - name: Upload to Release |
| 167 | + uses: softprops/action-gh-release@v2 |
| 168 | + if: startsWith(github.ref, 'refs/tags/') |
| 169 | + with: |
| 170 | + files: | |
| 171 | + artifacts/linux-cpu/*.tar.gz |
| 172 | + artifacts/linux-cuda/*.tar.gz |
| 173 | + artifacts/windows-cpu/*.zip |
| 174 | + artifacts/windows-cuda/*.zip |
| 175 | + fail_on_unmatched_files: false |
| 176 | + env: |
| 177 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 178 | + |
| 179 | + - name: Upload to manual release |
| 180 | + if: github.event_name == 'workflow_dispatch' |
| 181 | + uses: softprops/action-gh-release@v2 |
| 182 | + with: |
| 183 | + tag_name: ${{ github.event.inputs.tag }} |
| 184 | + files: | |
| 185 | + artifacts/linux-cpu/*.tar.gz |
| 186 | + artifacts/linux-cuda/*.tar.gz |
| 187 | + artifacts/windows-cpu/*.zip |
| 188 | + artifacts/windows-cuda/*.zip |
| 189 | + fail_on_unmatched_files: false |
| 190 | + env: |
| 191 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments