|
| 1 | +name: Build Native |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'dev' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build ${{ matrix.name }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + permissions: |
| 14 | + id-token: write |
| 15 | + contents: read |
| 16 | + attestations: write |
| 17 | + |
| 18 | + strategy: |
| 19 | + fail-fast: true |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - { os: ubuntu-24.04, name: linux-x64, ext: so, args: '' } |
| 23 | + - { os: ubuntu-24.04, name: linux-arm64, ext: so, args: '-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc' } |
| 24 | + - { os: windows-2025, name: win-x64, ext: dll, args: '-DZSTD_USE_STATIC_RUNTIME=ON' } |
| 25 | + - { os: windows-2025, name: win-x86, ext: dll, args: '-DZSTD_USE_STATIC_RUNTIME=ON -A Win32' } |
| 26 | + - { os: windows-2025, name: win-arm64, ext: dll, args: '-DZSTD_USE_STATIC_RUNTIME=ON -A ARM64' } |
| 27 | + - { os: macos-15, name: osx-arm64, ext: dylib, args: '' } |
| 28 | + - { os: macos-15-intel, name: osx-x64, ext: dylib, args: '' } |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout zstd sources |
| 32 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 33 | + with: |
| 34 | + repository: facebook/zstd |
| 35 | + ref: f8745da6ff1ad1e7bab384bd1f9d742439278e99 # v1.5.7 |
| 36 | + |
| 37 | + - name: Install GCC ARM64 |
| 38 | + if: ${{ matrix.name == 'linux-arm64' }} |
| 39 | + run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu -y |
| 40 | + |
| 41 | + - name: Configure CMake |
| 42 | + run: > |
| 43 | + cmake -S build/cmake -B output |
| 44 | + ${{ matrix.args }} |
| 45 | + -DCMAKE_BUILD_TYPE=Release |
| 46 | + -DCMAKE_COMPILE_WARNING_AS_ERROR=ON |
| 47 | + -DBUILD_SHARED_LIBS=ON |
| 48 | + -DZSTD_BUILD_TESTS=OFF |
| 49 | + -DZSTD_BUILD_SHARED=ON |
| 50 | + -DZSTD_BUILD_STATIC=OFF |
| 51 | + -DZSTD_BUILD_PROGRAMS=OFF |
| 52 | + -DZSTD_LIB_DEPRECATED=OFF |
| 53 | + -DZSTD_LEGACY_SUPPORT=0 |
| 54 | +
|
| 55 | + - name: Build using CMake |
| 56 | + run: cmake --build output --config Release |
| 57 | + |
| 58 | + - name: Rename shared lib file (Windows) |
| 59 | + if: ${{ startsWith(runner.os, 'win') }} |
| 60 | + run: mv output/lib/Release/zstd.dll output/lib/libzstd.dll |
| 61 | + |
| 62 | + - name: Move shared lib to runtimes |
| 63 | + run: | |
| 64 | + mkdir -p artifacts/runtimes/${{ matrix.name }}/native/ |
| 65 | + cp output/lib/libzstd.${{ matrix.ext }} artifacts/runtimes/${{ matrix.name }}/native/ |
| 66 | +
|
| 67 | + - name: Provenance attestation |
| 68 | + uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 |
| 69 | + with: |
| 70 | + subject-path: artifacts/runtimes/*/native/libzstd.* |
| 71 | + |
| 72 | + - name: Upload artifacts |
| 73 | + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 |
| 74 | + with: |
| 75 | + name: ${{ matrix.name }} |
| 76 | + path: artifacts/ |
0 commit comments