|
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
| 5 | + branches: |
| 6 | + - main |
5 | 7 | pull_request:
|
6 | 8 | # Run daily to catch when Rust updates cause problems to happen.
|
7 | 9 | schedule:
|
@@ -102,3 +104,94 @@ jobs:
|
102 | 104 |
|
103 | 105 | - name: 'Check documentation links in `libmimalloc-sys`'
|
104 | 106 | run: cargo rustdoc -p libmimalloc-sys2 -- -D warnings
|
| 107 | + |
| 108 | + build-example: |
| 109 | + name: Build example ${{ matrix.settings.target }} |
| 110 | + strategy: |
| 111 | + fail-fast: false |
| 112 | + matrix: |
| 113 | + settings: |
| 114 | + - host: macos-latest |
| 115 | + target: x86_64-apple-darwin |
| 116 | + - host: windows-latest |
| 117 | + target: x86_64-pc-windows-msvc |
| 118 | + - host: windows-latest |
| 119 | + target: i686-pc-windows-msvc |
| 120 | + - host: ubuntu-latest |
| 121 | + target: x86_64-unknown-linux-gnu |
| 122 | + - host: ubuntu-latest |
| 123 | + target: x86_64-unknown-linux-musl |
| 124 | + - host: macos-latest |
| 125 | + target: aarch64-apple-darwin |
| 126 | + - host: ubuntu-24.04-arm |
| 127 | + target: aarch64-unknown-linux-gnu |
| 128 | + - host: ubuntu-latest |
| 129 | + target: armv7-unknown-linux-gnueabihf |
| 130 | + - host: ubuntu-latest |
| 131 | + target: aarch64-linux-android |
| 132 | + - host: ubuntu-24.04-arm |
| 133 | + target: aarch64-unknown-linux-musl |
| 134 | + - host: windows-latest |
| 135 | + target: aarch64-pc-windows-msvc |
| 136 | + - host: ubuntu-latest |
| 137 | + target: powerpc64le-unknown-linux-gnu |
| 138 | + - host: ubuntu-latest |
| 139 | + target: s390x-unknown-linux-gnu |
| 140 | + - host: ubuntu-latest |
| 141 | + target: wasm32-wasip1-threads |
| 142 | + |
| 143 | + runs-on: ${{ matrix.settings.host }} |
| 144 | + |
| 145 | + steps: |
| 146 | + - uses: actions/checkout@v4 |
| 147 | + with: |
| 148 | + submodules: recursive |
| 149 | + |
| 150 | + - name: Install |
| 151 | + run: rustup target add ${{ matrix.settings.target }} |
| 152 | + |
| 153 | + - uses: goto-bus-stop/setup-zig@v2 |
| 154 | + if: ${{ contains(matrix.settings.target, 'musl') }} |
| 155 | + with: |
| 156 | + version: 0.14.0 |
| 157 | + |
| 158 | + - name: Install cargo-zigbuild |
| 159 | + uses: taiki-e/install-action@v2 |
| 160 | + if: ${{ contains(matrix.settings.target, 'musl') }} |
| 161 | + env: |
| 162 | + GITHUB_TOKEN: ${{ github.token }} |
| 163 | + with: |
| 164 | + tool: cargo-zigbuild |
| 165 | + |
| 166 | + - uses: actions/setup-node@v4 |
| 167 | + with: |
| 168 | + node-version: 22 |
| 169 | + |
| 170 | + - name: Install dependencies |
| 171 | + working-directory: example |
| 172 | + run: | |
| 173 | + corepack enable |
| 174 | + yarn install |
| 175 | +
|
| 176 | + - name: Install wasi-sdk |
| 177 | + run: | |
| 178 | + mkdir -p $HOME/wasi-sdk |
| 179 | + curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | tar -xzf - -C $HOME/wasi-sdk --strip-components=1 |
| 180 | + echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> $GITHUB_ENV |
| 181 | +
|
| 182 | + - name: Build |
| 183 | + working-directory: example |
| 184 | + shell: bash |
| 185 | + run: | |
| 186 | + if [[ "${{ matrix.settings.target }}" == *"musl"* ]]; then |
| 187 | + yarn build --target ${{ matrix.settings.target }} -x |
| 188 | + yarn build --target ${{ matrix.settings.target }} -x --release |
| 189 | + elif [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then |
| 190 | + export CFLAGS="-fuse-ld=lld" |
| 191 | + export CC=clang |
| 192 | + yarn build --target ${{ matrix.settings.target }} --use-napi-cross |
| 193 | + yarn build --target ${{ matrix.settings.target }} --use-napi-cross --release |
| 194 | + else |
| 195 | + yarn build --target ${{ matrix.settings.target }} |
| 196 | + yarn build --target ${{ matrix.settings.target }} --release |
| 197 | + fi |
0 commit comments