Possibly fix Windows builds #45
This file contains 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: 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: "cd builds/msvc/build/ && cmd buildbase.bat ../vs2022/libsodium.sln 17 && cd ../../..", | |
output-file: "bin/Win32/Release/v143/dynamic/libsodium.dll", | |
file: "sodium.dll", | |
rid: "win-x86", | |
arch: "x86" | |
} | |
- { | |
name: "Windows x64", | |
os: windows-latest, | |
command: "cd builds/msvc/build/ && cmd buildbase.bat ../vs2022/libsodium.sln 17 && cd ../../..", | |
output-file: "bin/x64/Release/v143/dynamic/libsodium.dll", | |
file: "sodium.dll", | |
rid: "win-x64", | |
arch: "x64" | |
} | |
- { | |
name: "Windows Arm64", | |
os: windows-latest, | |
command: "cd builds/msvc/build/ && cmd buildbase.bat ../vs2022/libsodium.sln 17 && cd ../../..", | |
output-file: "bin/arm64/Release/v143/dynamic/libsodium.dll", | |
file: "sodium.dll", | |
rid: "win-arm64", | |
arch: "arm64" | |
} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Checkout Sodium | |
uses: actions/checkout@v4 | |
with: | |
repository: jedisct1/libsodium | |
path: libs/sodium | |
fetch-tags: true | |
ref: fb4533b0a941b3a5b1db5687d1b008a5853d1f29 | |
- name: Setup Zig | |
uses: goto-bus-stop/setup-zig@v2 | |
with: | |
version: 0.11.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: | | |
cd libs/sodium | |
${{ 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 |