Begin using Zig to build on Linux #1929
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: '**' | |
| tags-ignore: '**' | |
| paths: | |
| - 'lib/**' | |
| - 'src/**' | |
| - 'Makefile' | |
| pull_request: | |
| branches: '**' | |
| paths: | |
| - 'lib/**' | |
| - 'src/**' | |
| - 'Makefile' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-lin: | |
| name: Linux Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - uses: mlugg/setup-zig@v2 | |
| - name: Build | |
| env: | |
| DEMO_SIGN_PUBKEY: ${{ secrets.SAR_DEMO_SIGN_PUBKEY }} | |
| DEMO_SIGN_PRIVKEY: ${{ secrets.SAR_DEMO_SIGN_PRIVKEY }} | |
| run: zig build --summary all -Doptimize=Debug -Ddemo-sign-pubkey="$DEMO_SIGN_PUBKEY" -Ddemo-sign-privkey="$DEMO_SIGN_PRIVKEY" -Dcanary=true | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sar-linux | |
| path: zig-out/lib/sar.so | |
| if-no-files-found: error | |
| - name: Upload to dl.sar.portal2.sr | |
| if: github.ref == 'refs/heads/master' && github.repository_owner == 'p2sr' | |
| env: | |
| DL_SAR_API_TOKEN: ${{ secrets.DL_SAR_API_TOKEN }} | |
| run: | | |
| SAR_VERSION=$(git describe --tags) | |
| curl -X "POST" \ | |
| -H "Authorization: Bearer $DL_SAR_API_TOKEN" \ | |
| -H "Content-Type: multipart/form-data" \ | |
| -F "version=$(echo $SAR_VERSION | awk -F- '{print $1}')-canary" \ | |
| -F "sar_version=$SAR_VERSION-canary" \ | |
| -F "system=linux" \ | |
| -F "commit=$GITHUB_SHA" \ | |
| -F "branch=$GITHUB_REF_NAME" \ | |
| -F "count=1" \ | |
| -F "hashes[0]=$(sha256sum zig-out/lib/sar.so | cut -d ' ' -f 1)" \ | |
| -F "files[0]=@zig-out/lib/sar.so" \ | |
| "https://dl.sar.portal2.jonesy.moe/api/v1/upload" | |
| build-win: | |
| name: Windows Build | |
| runs-on: windows-2019 | |
| permissions: | |
| contents: write | |
| env: | |
| POWERSHELL_TELEMETRY_OPTOUT: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: { fetch-depth: 0 } | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Build | |
| env: | |
| DEMO_SIGN_PUBKEY: ${{ secrets.SAR_DEMO_SIGN_PUBKEY }} | |
| DEMO_SIGN_PRIVKEY: ${{ secrets.SAR_DEMO_SIGN_PRIVKEY }} | |
| run: msbuild -m -t:SourceAutoRecord -p:"Configuration=Release;Platform=x86" SourceAutoRecord.sln | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sar-windows | |
| path: | | |
| bin\sar.dll | |
| bin\sar.pdb | |
| if-no-files-found: error | |
| - name: Upload to dl.sar.portal2.sr | |
| if: github.ref == 'refs/heads/master' && github.repository_owner == 'p2sr' | |
| shell: bash | |
| env: | |
| DL_SAR_API_TOKEN: ${{ secrets.DL_SAR_API_TOKEN }} | |
| run: | | |
| SAR_VERSION=$(git describe --tags) | |
| curl -X "POST" \ | |
| -H "Authorization: Bearer $DL_SAR_API_TOKEN" \ | |
| -H "Content-Type: multipart/form-data" \ | |
| -F "version=$(echo $SAR_VERSION | awk -F- '{print $1}')-canary" \ | |
| -F "sar_version=$SAR_VERSION-canary" \ | |
| -F "system=windows" \ | |
| -F "commit=$GITHUB_SHA" \ | |
| -F "branch=$GITHUB_REF_NAME" \ | |
| -F "count=2" \ | |
| -F "hashes[0]=$(sha256sum bin/sar.dll | cut -d ' ' -f 1)" \ | |
| -F "hashes[1]=$(sha256sum bin/sar.pdb | cut -d ' ' -f 1)" \ | |
| -F "files[0]=@bin/sar.dll" \ | |
| -F "files[1]=@bin/sar.pdb" \ | |
| "https://dl.sar.portal2.jonesy.moe/api/v1/upload" |