Skip to content

Try building with zig v12 to fix Windows race condition #57

Try building with zig v12 to fix Windows race condition

Try building with zig v12 to fix Windows race condition #57

Workflow file for this run

name: Update Sodium
on:
release:
types:
- published
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/workflows/sodium.yml'
permissions:
contents: write
jobs:
build:
name: Build Sodium for ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Android Arm64",
os: ubuntu-latest,
command: "./dist-build/android-armv8-a.sh",
output-file: "libsodium-android-armv8-a+crypto/lib/libsodium.so",
file: "libsodium.so",
rid: "android-arm64",
}
- {
name: "Linux x64 (glibc)",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu",
output-file: "zig-out/lib/libsodium.so",
file: "libsodium.so",
rid: "linux-x64",
}
- {
name: "Linux x64 (musl)",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86_64-linux-musl",
output-file: "zig-out/lib/libsodium.so",
file: "libsodium.so",
rid: "linux-x64-musl",
}
- {
name: "Linux Arm64 (glibc)",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-linux-gnu",
output-file: "zig-out/lib/libsodium.so",
file: "libsodium.so",
rid: "linux-arm64",
}
- {
name: "Linux Arm64 (musl)",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-linux-musl",
output-file: "zig-out/lib/libsodium.so",
file: "libsodium.so",
rid: "linux-arm64-musl",
}
- {
name: "MacOS x64",
os: macos-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86_64-macos",
output-file: "zig-out/lib/libsodium.dylib",
file: "libsodium.dylib",
rid: "osx-x64",
}
- {
name: "iOS",
os: macos-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-ios",
output-file: "zig-out/lib/libsodium.dylib",
file: "libsodium.dylib",
rid: "ios-arm64",
}
- {
name: "Windows x86",
os: windows-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=i686-windows",
output-file: "zig-out/lib/libsodium.dll",
file: "sodium.dll",
rid: "win-x86",
arch: "x86"
}
- {
name: "Windows x64",
os: windows-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86_64-windows",
output-file: "zig-out/lib/libsodium.dll",
file: "sodium.dll",
rid: "win-x64",
arch: "x64"
}
- {
name: "Windows Arm64",
os: windows-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-windows",
output-file: "zig-out/lib/libsodium.dll",
file: "sodium.dll",
rid: "win-arm64",
arch: "arm64"
}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
if: contains(matrix.config.command, 'zig')
with:
version: 0.12.0
cache: false
#- name: Set up MSBuild
# if: contains(matrix.config.rid, 'win')
# uses: microsoft/setup-msbuild@v2
# with:
# msbuild-architecture: ${{ matrix.config.arch }}
- name: Set up JDK 17
if: contains(matrix.config.rid, 'android')
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
if: contains(matrix.config.rid, 'android')
uses: android-actions/setup-android@v3
- name: Build on ${{ matrix.config.name }}
shell: bash
run: |
git clone https://github.com/jedisct1/libsodium.git libs/sodium
cd libs/sodium
git fetch --tags
SODIUM_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "SODIUM_VERSION=$SODIUM_VERSION" >> $GITHUB_ENV
git checkout $SODIUM_VERSION
${{ matrix.config.command }}
mkdir -p "${{ github.workspace }}/libs/libsodium/${{ matrix.config.rid }}/native"
rm -f "${{ github.workspace }}/libs/libsodium/${{ matrix.config.rid }}/native/${{ matrix.config.file }}"
mv ${{ matrix.config.output-file }} "${{ github.workspace }}/libs/libsodium/${{ matrix.config.rid }}/native/${{ matrix.config.file }}"
- name: "Update ${{ matrix.config.file }}"
uses: EndBug/add-and-commit@v9
with:
add: "libs/libsodium/"
default_author: github_actions
message: Update ${{ matrix.config.file }} to ${{ env.SODIUM_VERSION }}
pull: '--rebase --autostash'
push: true