File: rust.yml

package info (click to toggle)
rust-safe-arch 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 948 kB
  • sloc: python: 66; makefile: 2; sh: 1
file content (150 lines) | stat: -rw-r--r-- 5,087 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Rust

on:
  push: {}
  pull_request: {}
  workflow_dispatch: {}

jobs:
  build_test:
    runs-on: windows-latest
    strategy:
      matrix:
        rust:
        # x86
        - { target: i686-pc-windows-msvc, toolchain: 1.89.0 }
        - { target: i686-pc-windows-msvc, toolchain: stable }
        - { target: i686-pc-windows-msvc, toolchain: beta }
        - { target: i686-pc-windows-msvc, toolchain: nightly }
        # x86_64
        - { target: x86_64-pc-windows-msvc, toolchain: 1.89.0 }
        - { target: x86_64-pc-windows-msvc, toolchain: stable }
        - { target: x86_64-pc-windows-msvc, toolchain: beta }
        - { target: x86_64-pc-windows-msvc, toolchain: nightly }
    steps:
    - uses: actions/checkout@v1
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust.toolchain }}
        target:  ${{ matrix.rust.target }}
        profile: minimal
        default: true
    - name: suppress target-cpu=native on i586
      if: matrix.rust.target == 'i586-pc-windows-msvc'
      run: rm .cargo/config.toml
    - name: Run tests with default features
      run: cargo test --target ${{ matrix.rust.target }}
    - name: Run tests with all features
      run: cargo test --target ${{ matrix.rust.target }} --all-features

  avx512_emulated_test:
    runs-on: windows-latest
    strategy:
      matrix:
        rust:
          - { target: x86_64-pc-windows-msvc, toolchain: 1.89.0 }
          - { target: x86_64-pc-windows-msvc, toolchain: stable }
          - { target: x86_64-pc-windows-msvc, toolchain: beta }
          - { target: x86_64-pc-windows-msvc, toolchain: nightly }
    steps:
    - uses: actions/checkout@v3
    
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust.toolchain }}
        target: ${{ matrix.rust.target }}
        profile: minimal
        default: true
        
    - name: Cache Intel SDE
      id: cache-sde
      uses: actions/cache@v3
      with:
        path: sde-external-*
        key: ${{ runner.os }}-sde-9.58.0-2025-06-16

    - name: Set SDE path from cache
      if: steps.cache-sde.outputs.cache-hit == 'true'
      shell: bash
      run: |
        set -euo pipefail
        SDE_DIR=$(find . -maxdepth 1 -type d -name "sde-external-*")
        if [ -z "$SDE_DIR" ]; then
          echo "Error: SDE directory not found after cache restore"
          exit 1
        fi
        echo "Found SDE directory: $SDE_DIR"
        echo "$SDE_DIR" >> $GITHUB_PATH

    - name: Install Intel SDE
      if: steps.cache-sde.outputs.cache-hit != 'true'
      shell: bash
      run: |
        set -euo pipefail

        SDE_VERSION=9.58.0
        SDE_DATE=2025-06-16
        SDE_ID=859732
        SDE_FILENAME="sde-external-${SDE_VERSION}-${SDE_DATE}-win.tar.xz"

        echo "SDE_VERSION=$SDE_VERSION" >> $GITHUB_ENV
        echo "SDE_DATE=$SDE_DATE" >> $GITHUB_ENV
        echo "SDE_ID=$SDE_ID" >> $GITHUB_ENV
        echo "SDE_FILENAME=$SDE_FILENAME" >> $GITHUB_ENV

        for url in \
          "https://downloadmirror.intel.com/${SDE_ID}/${SDE_FILENAME}" \
          "https://software.intel.com/content/dam/develop/external/us/en/protected/${SDE_FILENAME}"; do
          echo "Trying $url"
          if curl -fLO "$url"; then
            echo "Downloaded $SDE_FILENAME"
            break
          fi
        done

        # Extract
        tar -xf "$SDE_FILENAME"
        SDE_DIR=$(find . -type d -name "sde-external-*")
        echo "$SDE_DIR" >> "$GITHUB_PATH"

    # Set RUSTFLAGS to enable AVX512
    - name: Set RUSTFLAGS for AVX512
      run: |
        echo "RUSTFLAGS=-C target-feature=+avx512f,+avx512dq,+avx512cd,+avx512bw,+avx512vl" >> $env:GITHUB_ENV
        echo "RUSTDOCFLAGS=-C target-feature=+avx512f,+avx512dq,+avx512cd,+avx512bw,+avx512vl" >> $env:GITHUB_ENV
      shell: powershell
    
    # Build tests with AVX512 features
    - name: Build tests with AVX512
      run: cargo test --target ${{ matrix.rust.target }} --no-run
    
    # Run tests under SDE emulation
    - name: Run tests under Intel SDE (Sapphire Rapids)
      shell: powershell
      run: |
        # Get all test executables
        $testExes = Get-ChildItem -Path "target\${{ matrix.rust.target }}\debug\deps" -Filter "*.exe" | 
                    Where-Object { $_.Name -match "^[^-]+-[a-f0-9]+\.exe$" }
        
        $failed = $false
        foreach ($exe in $testExes) {
          Write-Host "Running test: $($exe.Name)"
          & sde -spr -- $exe.FullName
          if ($LASTEXITCODE -ne 0) {
            Write-Host "Test failed: $($exe.Name)"
            $failed = $true
          }
        }
        
        if ($failed) {
          exit 1
        }
    
    # Also run doc tests under SDE
    - name: Run doc tests under Intel SDE
      shell: powershell
      run: |
        # This is trickier as cargo doesn't directly support running doc tests through a wrapper
        # We'll need to use CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER
        $env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER = "sde -spr --"
        cargo test --target ${{ matrix.rust.target }} --doc