Skip to content

Commit 1a02cbd

Browse files
committed
Revert to not using nix for building the natives,
as it causes more issues than it solves (build tools & dependency pinning, which should already be handled by vcpkg). We can revisit this in the future if we find a better way to use nix for this purpose. * re-order workflow properties to be more logical and easier to read. This reverts commit e62276d.
1 parent e62276d commit 1a02cbd

1 file changed

Lines changed: 18 additions & 57 deletions

File tree

.github/workflows/build-natives.yml

Lines changed: 18 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,26 @@ jobs:
2323
runs-on: windows-latest
2424
vcpkg-os-target: windows
2525
vcpkg-platform-target: x64
26-
run-prefix: ''
2726
- rid: win-arm64
2827
runs-on: windows-11-arm
2928
vcpkg-os-target: windows
3029
vcpkg-platform-target: arm64
31-
run-prefix: ''
3230
- rid: osx-x64
3331
runs-on: macos-15-intel
3432
vcpkg-os-target: osx
3533
vcpkg-platform-target: x64
36-
run-prefix: nix develop .#natives -c bash -eo pipefail -c
3734
- rid: osx-arm64
3835
runs-on: macos-15
3936
vcpkg-os-target: osx
4037
vcpkg-platform-target: arm64
41-
run-prefix: nix develop .#natives -c bash -eo pipefail -c
4238
- rid: linux-x64
4339
runs-on: ubuntu-latest
4440
vcpkg-os-target: linux
4541
vcpkg-platform-target: x64
46-
run-prefix: nix develop .#natives -c bash -eo pipefail -c
4742
- rid: linux-arm64
4843
runs-on: ubuntu-24.04-arm
4944
vcpkg-os-target: linux
5045
vcpkg-platform-target: arm64
51-
run-prefix: nix develop .#natives -c bash -eo pipefail -c
5246

5347
runs-on: ${{ matrix.runs-on }}
5448
env:
@@ -57,7 +51,6 @@ jobs:
5751
VCPKG_DOWNLOADS: ${{ github.workspace }}/.vcpkg-downloads
5852
VcpkgOSTarget: ${{ matrix.vcpkg-os-target }}
5953
VcpkgPlatformTarget: ${{ matrix.vcpkg-platform-target }}
60-
RUN_PREFIX: ${{ matrix.run-prefix }}
6154
Configuration: Release
6255
RuntimeIdentifier: ${{ matrix.rid }}
6356
DotnetVerbose: minimal
@@ -89,71 +82,39 @@ jobs:
8982
with:
9083
global-json-file: global.json
9184

92-
- name: Install Nix
93-
if: runner.os != 'Windows'
94-
uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6
95-
96-
- name: Setup dev environment
97-
if: runner.os != 'Windows'
98-
shell: pwsh
99-
run: 'true'
85+
# - name: Install Nix
86+
# if: runner.os != 'Windows'
87+
# uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6
10088

10189
- name: Restore
10290
shell: pwsh
10391
run: |
104-
$command = @'
10592
dotnet restore Tests/NetCord.Natives.Tests/NetCord.Natives.Tests.csproj -v ${{ env.DotnetVerbose }} ${{ env.GenerateBinLog == 'true' && '-bl:restore.binlog' || '' }}
106-
'@
107-
108-
if ($env:RUN_PREFIX) {
109-
Invoke-Expression "$env:RUN_PREFIX `"$command`""
110-
}
111-
else {
112-
Invoke-Expression $command
113-
}
11493
11594
- name: Build natives projects for ${{ matrix.rid }}
11695
shell: pwsh
117-
run: | # Building tests will build dependencies including the native libraries
118-
$command = @'
119-
dotnet build Tests/NetCord.Natives.Tests/NetCord.Natives.Tests.csproj --no-restore -v ${{ env.DotnetVerbose }} ${{ env.GenerateBinLog == 'true' && '-bl:build.binlog' || '' }} -p:AppendNativeAotAppProps="RuntimeIdentifier=${{ env.RuntimeIdentifier }}" -p:GeneratePackageOnBuild=false -p:CI=false
120-
'@
121-
122-
if ($env:RUN_PREFIX) {
123-
Invoke-Expression "$env:RUN_PREFIX `"$command`""
124-
}
125-
else {
126-
Invoke-Expression $command
127-
}
96+
run: > # Building tests will build dependencies including the native libraries
97+
dotnet build Tests/NetCord.Natives.Tests/NetCord.Natives.Tests.csproj --no-restore -v ${{ env.DotnetVerbose }}
98+
${{ env.GenerateBinLog == 'true' && '-bl:build.binlog' || '' }}
99+
-p:AppendNativeAotAppProps="RuntimeIdentifier=${{ env.RuntimeIdentifier }}"
100+
-p:GeneratePackageOnBuild=false -p:CI=false
128101
129102
- name: Test natives outputs for ${{ matrix.rid }}
130103
shell: pwsh
131-
run: |
132-
$command = @'
133-
dotnet test Tests/NetCord.Natives.Tests/NetCord.Natives.Tests.csproj --no-restore --no-build -v ${{ env.DotnetVerbose }} ${{ env.GenerateBinLog == 'true' && '-bl:test.binlog' || '' }} --logger "console;verbosity=detailed" --logger GitHubActions
134-
'@
135-
136-
if ($env:RUN_PREFIX) {
137-
Invoke-Expression "$env:RUN_PREFIX `"$command`""
138-
}
139-
else {
140-
Invoke-Expression $command
141-
}
104+
run: >
105+
dotnet test Tests/NetCord.Natives.Tests/NetCord.Natives.Tests.csproj --no-restore --no-build -v ${{ env.DotnetVerbose }}
106+
${{ env.GenerateBinLog == 'true' && '-bl:test.binlog' || '' }}
107+
--logger "console;verbosity=detailed"
108+
--logger GitHubActions
142109
143110
- name: Pack NuGet Package for ${{ matrix.rid }}
144111
if: ${{ always() }}
145112
shell: pwsh
146-
run: |
147-
$command = @'
148-
dotnet pack NetCord.Natives/NetCord.Natives.csproj --no-restore --no-build -v ${{ env.DotnetVerbose }} ${{ env.GenerateBinLog == 'true' && '-bl:pack.binlog' || '' }} -o NetCord.Natives/bin/${{ matrix.rid }} -p:CI=false
149-
'@
150-
151-
if ($env:RUN_PREFIX) {
152-
Invoke-Expression "$env:RUN_PREFIX `"$command`""
153-
}
154-
else {
155-
Invoke-Expression $command
156-
}
113+
run: >
114+
dotnet pack NetCord.Natives/NetCord.Natives.csproj --no-restore --no-build -v ${{ env.DotnetVerbose }}
115+
${{ env.GenerateBinLog == 'true' && '-bl:pack.binlog' || '' }}
116+
-o NetCord.Natives/bin/${{ matrix.rid }}
117+
-p:CI=false
157118
158119
- name: Upload Binary Logs
159120
if: ${{ env.GenerateBinLog == 'true' && always() }}

0 commit comments

Comments
 (0)