|
50 | 50 |
|
51 | 51 | - name: Test |
52 | 52 | run: cargo test --target ${{ matrix.target }} --all-targets --all-features -- --nocapture |
53 | | - |
| 53 | + |
| 54 | + test-on-wine: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v6 |
| 58 | + - name: Install latest rust nightly |
| 59 | + uses: dtolnay/rust-toolchain@nightly |
| 60 | + - name: Add windows rust targets |
| 61 | + run: | |
| 62 | + rustup target add x86_64-pc-windows-msvc --toolchain nightly |
| 63 | + rustup target add i686-pc-windows-msvc --toolchain nightly |
| 64 | + - name: Install cargo-xwin |
| 65 | + run: cargo install cargo-xwin |
| 66 | + - name: Install Wine |
| 67 | + run: | |
| 68 | + sudo apt-get install ppa-purge && sudo ppa-purge -y ppa:ubuntu-toolchain-r/test |
| 69 | + sudo dpkg --add-architecture i386 |
| 70 | + sudo mkdir -pm755 /etc/apt/keyrings && sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key |
| 71 | + sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources |
| 72 | + sudo apt-get update |
| 73 | + sudo apt install --install-recommends winehq-stable |
| 74 | + - name: Run tests on Wine |
| 75 | + run: ./scripts/test-wine.ps1 |
| 76 | + shell: pwsh |
| 77 | + |
54 | 78 | arm-build: |
55 | 79 | runs-on: windows-latest |
56 | 80 | steps: |
@@ -118,3 +142,108 @@ jobs: |
118 | 142 | components: rustfmt |
119 | 143 | - name: Format check |
120 | 144 | run: cargo fmt --all -- --check |
| 145 | + |
| 146 | + build-c-libs: |
| 147 | + strategy: |
| 148 | + matrix: |
| 149 | + include: |
| 150 | + - os: windows-latest |
| 151 | + target: x86_64-pc-windows-msvc |
| 152 | + use_cross: false |
| 153 | + features: "c-exports,into-x86-from-x64" |
| 154 | + - os: windows-latest |
| 155 | + target: i686-pc-windows-msvc |
| 156 | + use_cross: false |
| 157 | + features: "c-exports" |
| 158 | + runs-on: ${{ matrix.os }} |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v6 |
| 161 | + - id: build-libs |
| 162 | + uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1 |
| 163 | + with: |
| 164 | + target: ${{ matrix.target }} |
| 165 | + use_pgo: false |
| 166 | + use_cross: ${{ matrix.use_cross }} |
| 167 | + features: ${{ matrix.features }} |
| 168 | + no_default_features: true |
| 169 | + |
| 170 | + build-c-headers: |
| 171 | + runs-on: ubuntu-latest |
| 172 | + steps: |
| 173 | + - uses: actions/checkout@v6 |
| 174 | + - name: Generate C++ bindings |
| 175 | + uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1 |
| 176 | + with: |
| 177 | + config_file: cbindgen_cpp.toml |
| 178 | + header_file: bindings_cpp.hpp |
| 179 | + - name: Generate C bindings |
| 180 | + uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1 |
| 181 | + with: |
| 182 | + config_file: cbindgen_c.toml |
| 183 | + header_file: bindings_c.h |
| 184 | + |
| 185 | + build-dotnet-library: |
| 186 | + needs: build-c-libs |
| 187 | + runs-on: ubuntu-latest |
| 188 | + steps: |
| 189 | + - name: Checkout repository |
| 190 | + uses: actions/checkout@v6 |
| 191 | + - name: Build and Package .NET Library |
| 192 | + uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-dotnet-library@dotnet-bindings |
| 193 | + with: |
| 194 | + targets: 'x86_64-pc-windows-msvc,i686-pc-windows-msvc' |
| 195 | + |
| 196 | + publish-crate: |
| 197 | + permissions: |
| 198 | + contents: write |
| 199 | + needs: [test,build-c-libs,build-c-headers,test-on-wine,build-dotnet-library] |
| 200 | + if: startsWith(github.ref, 'refs/tags/') |
| 201 | + runs-on: ubuntu-latest |
| 202 | + steps: |
| 203 | + - uses: actions/checkout@v6 |
| 204 | + - name: Download Artifacts |
| 205 | + uses: actions/download-artifact@v4 |
| 206 | + with: |
| 207 | + path: artifacts |
| 208 | + - name: Upload to NuGet |
| 209 | + shell: pwsh |
| 210 | + run: | |
| 211 | + $items = Get-ChildItem -Path "artifacts/**.nupkg" -Recurse |
| 212 | + Foreach ($item in $items) |
| 213 | + { |
| 214 | + Write-Host "Pushing $item" |
| 215 | + dotnet nuget push "$item" -k "${{ secrets.NUGET_KEY }}" -s "https://api.nuget.org/v3/index.json" --skip-duplicate |
| 216 | + } |
| 217 | +
|
| 218 | + $items = Get-ChildItem -Path "artifacts/**.snupkg" -Recurse |
| 219 | + Foreach ($item in $items) |
| 220 | + { |
| 221 | + Write-Host "Pushing Symbol Package $item" |
| 222 | + dotnet nuget push "$item" -k "${{ secrets.NUGET_KEY }}" -s "https://api.nuget.org/v3/index.json" --skip-duplicate |
| 223 | + } |
| 224 | + - name: Compress Artifacts |
| 225 | + shell: bash |
| 226 | + run: | |
| 227 | + dir="artifacts" |
| 228 | + if [ ! -d "$dir" ]; then |
| 229 | + echo "Directory $dir does not exist. No artifacts found." |
| 230 | + exit 0 |
| 231 | + fi |
| 232 | +
|
| 233 | + for subdir in "$dir"/*; do |
| 234 | + if [ -d "$subdir" ]; then |
| 235 | + base=$(basename "$subdir") |
| 236 | + zip -r "$dir/$base.zip" "$subdir" |
| 237 | + rm -r "$subdir" |
| 238 | + fi |
| 239 | + done |
| 240 | + ls -A ./artifacts |
| 241 | + - name: GitHub Release Artifacts |
| 242 | + uses: softprops/action-gh-release@v1 |
| 243 | + with: |
| 244 | + files: | |
| 245 | + artifacts/* |
| 246 | + - name: Publish to crates.io |
| 247 | + uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/publish-crate@v1 |
| 248 | + with: |
| 249 | + token: ${{ secrets.CRATES_IO_TOKEN }} |
0 commit comments