-
Notifications
You must be signed in to change notification settings - Fork 3
159 lines (157 loc) · 5.73 KB
/
sodium.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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: "MacOS Arm64",
os: macos-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-macos",
output-file: "zig-out/lib/libsodium.dylib",
file: "libsodium.dylib",
rid: "osx-arm64",
}
- {
name: "iOS Arm64",
os: macos-latest,
command: "export LIBSODIUM_SKIP_SIMULATORS=1; \
bash -x dist-build/apple-xcframework.sh; \
find .",
output-file: "zig-out/lib/libsodium.dylib",
file: "libsodium.dylib",
rid: "ios-arm64",
}
- {
name: "Windows x86",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86-windows",
output-file: "zig-out/lib/sodium_shared.dll",
file: "sodium.dll",
rid: "win-x86",
arch: "x86"
}
- {
name: "Windows x64",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86_64-windows",
output-file: "zig-out/lib/sodium_shared.dll",
file: "sodium.dll",
rid: "win-x64",
arch: "x64"
}
- {
name: "Windows Arm64",
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=aarch64-windows",
output-file: "zig-out/lib/sodium_shared.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.11.0
- 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
continue-on-error: true
run: |
git config --global core.filemode false
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 }}"
sleep $(( ${{ strategy.job-index }} * 2 ))
- 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