-
Notifications
You must be signed in to change notification settings - Fork 3
171 lines (169 loc) · 6.14 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
160
161
162
163
164
165
166
167
168
169
170
171
name: Update Sodium
on:
workflow_dispatch:
push:
branches:
- master
paths:
- '.github/workflows/sodium.yml'
- '.github/scripts/package-sodium.sh'
# Once every 2 months
schedule:
- cron: '0 0 1 */2 *'
permissions:
contents: write
jobs:
build:
name: Build Sodium for ${{ matrix.config.rid }}
runs-on: ${{ matrix.config.os }}
outputs:
version: ${{ steps.build.outputs.version }}
strategy:
fail-fast: false
matrix:
config:
- {
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",
}
- {
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",
}
- {
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-musl-x64",
}
- {
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",
}
- {
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-musl-arm64",
}
- {
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",
}
- {
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",
}
- {
os: macos-latest,
command: "bash ../../.github/scripts/apple-xcframework.sh",
output-file: "libsodium-apple/ios/lib/libsodium.dylib",
file: "libsodium.dylib",
rid: "ios-arm64",
}
- {
os: ubuntu-latest,
command: "zig build -Dshared=true -Doptimize=ReleaseFast -Dtarget=x86-windows",
output-file: "zig-out/lib/libsodium.dll",
file: "sodium.dll",
rid: "win-x86",
arch: "x86"
}
- {
os: ubuntu-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"
}
- {
os: ubuntu-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
- 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 ${{ matrix.config.file }}"
id: build
shell: bash
run: |
export WORKSPACE='${{ github.workspace }}'
export COMMAND='${{ matrix.config.command }}'
export OUTPUT_FILE='${{ matrix.config.output-file }}'
export FILE='${{ matrix.config.file }}'
export RID='${{ matrix.config.rid }}'
export JOB_INDEX='${{ strategy.job-index }}'
bash '${{ github.workspace }}/.github/scripts/package-sodium.sh'
- name: "Update ${{ matrix.config.rid }}"
uses: EndBug/add-and-commit@v9
with:
add: "libs/libsodium/"
default_author: github_actions
message: Update Sodium ${{ matrix.config.rid }} to ${{ steps.build.outputs.version }}
pull: "--rebase --autostash"
push: true
- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: sodium-${{ steps.build.outputs.version }}-${{ matrix.config.rid }}
path: libs/libsodium/${{ matrix.config.rid }}/native/${{ matrix.config.file }}
update-version:
name: Update .NET project version
needs: build
runs-on: ubuntu-latest
if: needs.build.outputs.version != ''
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update version
run: |
sed -i "s|<Version>.*</Version>|<Version>${{ needs.build.outputs.version }}</Version>|g" "${{ github.workspace }}/src/DSharpPlus.VoiceLink.Natives.Sodium/DSharpPlus.VoiceLink.Natives.Sodium.csproj"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Push changes"
uses: EndBug/add-and-commit@v9
with:
add: "src/DSharpPlus.VoiceLink.Natives.Sodium/DSharpPlus.VoiceLink.Natives.Sodium.csproj"
default_author: github_actions
message: Update Sodium version to ${{ needs.build.outputs.version }}
pull: "--rebase --autostash"
push: true